1
0
Fork 0
forked from github/pelican

Add MARKDOWN_EXTENTIONS configuration parameter to enable Markdown extentions of your choice.

Ex: MARKDOWN_EXTENTIONS = [ 'toc', ] enable TOC markup to generate Table of Contents.
This commit is contained in:
stephane 2012-09-27 19:49:42 +02:00
commit 4f5253bcb3
2 changed files with 4 additions and 3 deletions

View file

@ -18,7 +18,6 @@ import re
from pelican.contents import Category, Tag, Author
from pelican.utils import get_date, pelican_open
_METADATA_PROCESSORS = {
'tags': lambda x, y: [Tag(tag, y) for tag in unicode(x).split(',')],
'date': lambda x, y: get_date(x),
@ -125,12 +124,13 @@ 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', [])
text = pelican_open(filename)
md = Markdown(extensions=set(self.extensions + ['meta']))
md = Markdown(extensions=set(self.extensions + markdown_extentions + ['meta']))
content = md.convert(text)
metadata = {}

View file

@ -75,6 +75,7 @@ _DEFAULT_CONFIG = {'PATH': '.',
'SUMMARY_MAX_LENGTH': 50,
'WEBASSETS': False,
'PLUGINS': [],
'MARKDOWN_EXTENTIONS': [],
}