Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore bullet list in markdown syntax #92

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions toc-org-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -288,5 +288,8 @@
(let ((beg "# About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an up-to-date table of contents in the\norg files without exporting (useful primarily for readme files on\nGitHub).\n\nIt is similar to the [[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works for org files.\n:TOC:\n drawer\n:END:\n# Hello\n## Good-bye ##\n### Salut\n# Table of Contents "))
(test-toc-org-insert-toc-gold-test-markdown
(concat beg "<-- :TOC: -->")
"# About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an up-to-date table of contents in the\norg files without exporting (useful primarily for readme files on\nGitHub).\n\nIt is similar to the [[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works for org files.\n:TOC:\n drawer\n:END:\n# Hello\n## Good-bye ##\n### Salut\n# Table of Contents <-- :TOC: -->\n- [About](#about)\n- [Hello](#hello)\n - [Good-bye](#good-bye)\n")
))
"# About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an up-to-date table of contents in the\norg files without exporting (useful primarily for readme files on\nGitHub).\n\nIt is similar to the [[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works for org files.\n:TOC:\n drawer\n:END:\n# Hello\n## Good-bye ##\n### Salut\n# Table of Contents <-- :TOC: -->\n- [About](#about)\n- [Hello](#hello)\n - [Good-bye](#good-bye)\n"))
(let ((beg "# About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an up-to-date table of contents in the\norg files without exporting (useful primarily for readme files on\nGitHub).\n\n* This list shouldn't be part of the TOC\n** The sublist, too\n* Yes, it shouldn't \n*** I mean it!\n\nIt is similar to the [[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works for org files.\n:TOC:\n drawer\n:END:\n# Hello\n## Good-bye ##\n### Salut\n# Table of Contents "))
(test-toc-org-insert-toc-gold-test-markdown
(concat beg "<-- :TOC: -->")
"# About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an up-to-date table of contents in the\norg files without exporting (useful primarily for readme files on\nGitHub).\n\n* This list shouldn't be part of the TOC\n** The sublist, too\n* Yes, it shouldn't \n*** I mean it!\n\nIt is similar to the [[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works for org files.\n:TOC:\n drawer\n:END:\n# Hello\n## Good-bye ##\n### Salut\n# Table of Contents <-- :TOC: -->\n- [About](#about)\n- [Hello](#hello)\n - [Good-bye](#good-bye)\n")))
3 changes: 3 additions & 0 deletions toc-org.el
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ auxiliary text."
(save-excursion
(let ((case-fold-search t))
(goto-char (point-min))
(while (re-search-forward "^\\*" nil t)
(replace-match "" nil nil))
(goto-char (point-min))
(while (re-search-forward "^#+ " nil t)
(replace-match (concat
(make-string (1- (length (match-string 0))) ?*)
Expand Down