forked from tildetown/tilde-wiki
Compare commits
No commits in common. "toc-extension" and "master" have entirely different histories.
toc-extens
...
master
|
@ -5,7 +5,6 @@ from shutil import copy
|
|||
from typing import Optional, Callable
|
||||
|
||||
from markdown import markdown
|
||||
from markdown.extensions.toc import TocExtension
|
||||
|
||||
DOUBLE_NEWLINE_RE = re.compile(r'\n\n', flags=re.MULTILINE|re.DOTALL)
|
||||
HEADER_TITLE_RE = re.compile(r'<h([12])>(.*?)</h\1>')
|
||||
|
@ -190,9 +189,7 @@ def compile_markdown(file_path:str) -> str:
|
|||
"""Given a string of markdown, compiles it and returns the result."""
|
||||
return markdown(
|
||||
slurp(file_path),
|
||||
output_format='html5',
|
||||
# Allow tables of contents and exclude <h1> tags (page titles)
|
||||
extensions=[TocExtension(toc_depth='2-6')])
|
||||
output_format='html5')
|
||||
|
||||
def compile_plaintext(file_path:str) -> str:
|
||||
output = '<p>\n'
|
||||
|
|
Loading…
Reference in New Issue