mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Update docs and tests for MARKDOWN_EXTENTIONS
This commit is contained in:
parent
226aa2d8f3
commit
45c836fdf5
5 changed files with 30 additions and 9 deletions
|
|
@ -101,7 +101,7 @@ class RstReader(Reader):
|
|||
def _get_publisher(self, filename):
|
||||
extra_params = {'initial_header_level': '2'}
|
||||
pub = docutils.core.Publisher(
|
||||
destination_class=docutils.io.StringOutput)
|
||||
destination_class=docutils.io.StringOutput)
|
||||
pub.set_components('standalone', 'restructuredtext', 'html')
|
||||
pub.writer.translator_class = PelicanHTMLTranslator
|
||||
pub.process_programmatic_settings(None, extra_params, None)
|
||||
|
|
@ -124,13 +124,17 @@ class RstReader(Reader):
|
|||
class MarkdownReader(Reader):
|
||||
enabled = bool(Markdown)
|
||||
file_extensions = ['md', 'markdown', 'mkd']
|
||||
extensions = ['codehilite', 'extra' ]
|
||||
extensions = ['codehilite', 'extra']
|
||||
|
||||
def read(self, filename):
|
||||
"""Parse content and metadata of markdown files"""
|
||||
markdown_extentions = self.settings.get('MARKDOWN_EXTENTIONS', [])
|
||||
if isinstance(markdown_extentions, (str, unicode)):
|
||||
markdown_extentions = [m.strip() for m in
|
||||
markdown_extentions.split(',')]
|
||||
text = pelican_open(filename)
|
||||
md = Markdown(extensions=set(self.extensions + markdown_extentions + ['meta']))
|
||||
md = Markdown(extensions=set(
|
||||
self.extensions + markdown_extentions + ['meta']))
|
||||
content = md.convert(text)
|
||||
|
||||
metadata = {}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ _DEFAULT_CONFIG = {'PATH': '.',
|
|||
'SUMMARY_MAX_LENGTH': 50,
|
||||
'WEBASSETS': False,
|
||||
'PLUGINS': [],
|
||||
'MARKDOWN_EXTENTIONS': [],
|
||||
'MARKDOWN_EXTENTIONS': [ 'toc', ],
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue