将python markdown字段类型添加到lektor,以使用python markdown作为渲染器。
lektor-pythonmarkdown的Python项目详细描述
Lektor Python降价插件
使用Lektor插件解析标记
Python-Markdown。默认情况下,莱克托
使用mistune解析标记
字段。
使用这个插件,您可以通过设置
字段上的不同类型。或者:markdown
或者pythonmarkdown
安装
从命令行将lektor pythonmarkdown添加到项目中:
lektor plugins add lektor-pythonmarkdown
用法
在您的模型中,您需要按如下方式定义字段的类型:
[model]
name = Page
[fields.body]
label = Body
type = pythonmarkdown
警告!
这个插件显然与所有错误的特定事件和插件不兼容。也就是说,所有的markdown-*
事件和围绕它们构建的插件。
高级配置
这个lektor插件提供了一种配置python标记的好方法。例如,可以显式定义要启用的扩展,并分别配置每个扩展。
对于高级配置,需要在configs
文件夹中创建名为pythonmarkdown.ini
的文件。
在该文件中,您可以编写类似于以下内容的内容:
[markdown]
# Define the configuration of python-markdown.
# Reference: https://python-markdown.github.io/reference/#markdown
#output_format = xhtml1
#tab_length = 4
#safe_mode = False
#enable_attributes = True
#smart_emphasis = True
#lazy_ol = True
[extensions]
# List extensions to be enabled.
markdown.extensions.extra = 1
markdown.extensions.admonition = 1
markdown.extensions.codehilite = 1
markdown.extensions.meta = 1
markdown.extensions.nl2br = 1
markdown.extensions.sane_lists = 1
markdown.extensions.smarty = 1
markdown.extensions.toc = 1
markdown.extensions.wikilinks = 1
[markdown.extensions.codehilite]
# Specific configuration for an extension.
# Reference: https://python-markdown.github.io/extensions/code_hilite/#usage
linenums = True
#guess_lang = True
#css_class = codehilite
#pygments_style = default
#noclasses = False
#use_pygments = True