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

Conditionally insert header, title, and footer #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
16 changes: 11 additions & 5 deletions markdown-toc.el
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,17 @@ Return the end position if it exists, nil otherwise."

(defun markdown-toc--compute-full-toc (toc)
"Given the TOC's content, compute the full toc with comments and title."
(format "%s\n%s\n\n%s\n\n%s\n"
markdown-toc-header-toc-start
markdown-toc-header-toc-title
toc
markdown-toc-header-toc-end))
(-as-> "" s
(if markdown-toc-header-toc-start
(concat s markdown-toc-header-toc-start "\n")
s)
(if markdown-toc-header-toc-title
(concat s markdown-toc-header-toc-title "\n\n")
s)
(concat s toc "\n\n")
(if markdown-toc-header-toc-end
(concat s markdown-toc-header-toc-end "\n")
s)))

;;;###autoload
(defun markdown-toc-generate-toc (&optional replace-toc-p)
Expand Down