mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Avoid Markdown 2.6 deprecations; make MD_EXTENSIONS a dict
* Make MD_EXTENSIONS setting a dict and add tests for this change;
* Short extension names ('extra', 'meta') are deprecated
https://pythonhosted.org/Markdown/release-2.6.html#shortened-extension-names-deprecated
* Extension config as part of extension name is deprecated
https://pythonhosted.org/Markdown/release-2.6.html#extension-configuration-as-part-of-extension-name-deprecated
This commit is contained in:
parent
a2852da3e7
commit
510961bbb9
6 changed files with 51 additions and 15 deletions
|
|
@ -50,7 +50,10 @@ Take a look at the Markdown reader::
|
|||
def read(self, source_path):
|
||||
"""Parse content and metadata of markdown files"""
|
||||
text = pelican_open(source_path)
|
||||
md = Markdown(extensions = ['meta', 'codehilite'])
|
||||
md_extensions = {'markdown.extensions.meta': {},
|
||||
'markdown.extensions.codehilite': {}}
|
||||
md = Markdown(extensions=md_extensions.keys(),
|
||||
extension_configs=md_extensions)
|
||||
content = md.convert(text)
|
||||
|
||||
metadata = {}
|
||||
|
|
|
|||
|
|
@ -112,15 +112,15 @@ Setting name (followed by default value, if any)
|
|||
of these patterns will be ignored by the processor. For example,
|
||||
the default ``['.#*']`` will ignore emacs lock files, and
|
||||
``['__pycache__']`` would ignore Python 3's bytecode caches.
|
||||
``MD_EXTENSIONS =`` ``['codehilite(css_class=highlight)','extra']`` A list of the extensions that the Markdown processor
|
||||
will use. Refer to the Python Markdown documentation's
|
||||
``MD_EXTENSIONS =`` ``{...}`` A dict of the extensions that the Markdown processor
|
||||
will use, with extensions' settings as the values.
|
||||
Refer to the Python Markdown documentation's
|
||||
`Extensions section <http://pythonhosted.org/Markdown/extensions/>`_
|
||||
for a complete list of supported extensions. (Note that
|
||||
defining this in your settings file will override and
|
||||
replace the default values. If your goal is to *add*
|
||||
to the default values for this setting, you'll need to
|
||||
include them explicitly and enumerate the full list of
|
||||
desired Markdown extensions.)
|
||||
for a complete list of supported extensions and their options.
|
||||
Default is ``{'markdown.extensions.codehilite' : {'css_class': 'highlight'},
|
||||
'markdown.extensions.extra': {}, 'markdown.extensions.meta': {}}``.
|
||||
(Note that the dictionary defined in your settings file will
|
||||
update this default one.)
|
||||
``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``
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue