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.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6453dc3aeda628902924667016ea218e755e97d37dee6e768db0b6bace33ef16 |
|
MD5 | c2af7b4eae8bd92d74ef01a88b82481a |
|
BLAKE2b-256 | 550fa1b3525a2b4312bcda68f40b95dae9cf7dd5081dce79dec746e584055aa4 |
Close
Hashes for clld_markdown_plugin-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad986f7e1f0dbe88f4250d26b4173c591415a2fc98ee65ec162927a42d73413d |
|
MD5 | 180c4884f7b95dc24eb00b88a8c08b29 |
|
BLAKE2b-256 | 5854068183bd5b4e6ca741281d25c1125dcd6d283320574dfbff740ce8d3678b |