mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge b02e0ffb07 into a2852da3e7
This commit is contained in:
commit
886c0cd05d
4 changed files with 8 additions and 2 deletions
|
|
@ -53,7 +53,8 @@ install Markdown``.
|
|||
|
||||
Pelican also supports `Markdown Extensions`_, which might have to be installed
|
||||
separately if they are not included in the default ``Markdown`` package and can
|
||||
be configured and loaded via the ``MD_EXTENSIONS`` setting.
|
||||
be configured and loaded via the ``MD_EXTENSIONS`` setting. The
|
||||
``MD_EXTENSION_CONFIGS`` setting controls extensions configuration.
|
||||
|
||||
Metadata syntax for Markdown posts should follow this pattern::
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@ Setting name (followed by default value, if any)
|
|||
to the default values for this setting, you'll need to
|
||||
include them explicitly and enumerate the full list of
|
||||
desired Markdown extensions.)
|
||||
``MD_EXTENSION_CONFIGS = {}`` A configuration dictionary for the extensions the Markdown
|
||||
processor will use.
|
||||
``OUTPUT_PATH = 'output/'`` Where to output the generated files.
|
||||
``PATH`` Path to content directory to be processed by Pelican. If undefined,
|
||||
and content path is not specified via an argument to the ``pelican``
|
||||
|
|
|
|||
|
|
@ -247,6 +247,7 @@ class MarkdownReader(BaseReader):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super(MarkdownReader, self).__init__(*args, **kwargs)
|
||||
self.extensions = list(self.settings['MD_EXTENSIONS'])
|
||||
self.extension_configs = self.settings['MD_EXTENSION_CONFIGS']
|
||||
if 'meta' not in self.extensions:
|
||||
self.extensions.append('meta')
|
||||
self._source_path = None
|
||||
|
|
@ -284,7 +285,8 @@ class MarkdownReader(BaseReader):
|
|||
"""Parse content and metadata of markdown files"""
|
||||
|
||||
self._source_path = source_path
|
||||
self._md = Markdown(extensions=self.extensions)
|
||||
self._md = Markdown(extensions=self.extensions,
|
||||
extension_configs=self.extension_configs)
|
||||
with pelican_open(source_path) as text:
|
||||
content = self._md.convert(text)
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ DEFAULT_CONFIG = {
|
|||
'DEFAULT_DATE_FORMAT': '%a %d %B %Y',
|
||||
'DATE_FORMATS': {},
|
||||
'MD_EXTENSIONS': ['codehilite(css_class=highlight)', 'extra'],
|
||||
'MD_EXTENSION_CONFIGS': {},
|
||||
'JINJA_EXTENSIONS': [],
|
||||
'JINJA_FILTERS': {},
|
||||
'LOG_FILTER': [],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue