Render CLDF markdown in clld apps.
Project description
clld-markdown-plugin
Render CLDF markdown in clld apps
Usage
Include (and configure the plugin) in your app's main
function:
def main(global_config, **settings):
settings['clld_markdown_plugin'] = {
'model_map': {'ValueTable': common.ValueSet},
'function_map': {}
}
config = Configurator(settings=settings)
config.include('clld.web.app')
...
config.include('clld_markdown_plugin')
Then you can use clld_markdown_plugin.markup
as follows in your templates:
<%! from clld_markdown_plugin import markdown %>
${markdown(req, '[x](LanguageTable#cldf:abad1241)')|n}
Renderer callables
The renderer_map
configuration option for clld_markdown_plugin
accepts a dict
mapping
CLDF component names to Python callables with the following signature:
import clld.web.app
def renderer(req: clld.web.app.ClldRequest, objid: str, table, session: clld.db.meta.DBSession, ids=None) -> str:
"""
The returned `str` is interpreted as Markdown, so it may also include HTML.
"""
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for clld_markdown_plugin-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6d472bb70a52399bcb83cb3b3315b2edd3d6ed57fb32b9672841793638ca383 |
|
MD5 | 146dd886f002c08f901a536814c4af74 |
|
BLAKE2b-256 | fca7da286ba9c5640fc84d1c2c3bbfbb3136821d08168b2c8e399a31db504418 |
Close
Hashes for clld_markdown_plugin-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 578eacb4f01f0d8e2fec6a636c68f03e63fa3bb6fdf72fd6532644a0a0a60437 |
|
MD5 | 95757fcfebef7fba2cc78580e3daebb8 |
|
BLAKE2b-256 | 411e1d5bef45ab1c109822099d67bcfe8d9b6324d65beb99ea399410b5634e5d |