Skip to main content

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

clld_markdown_plugin-0.2.0.tar.gz (8.6 kB view hashes)

Uploaded Source

Built Distribution

clld_markdown_plugin-0.2.0-py3-none-any.whl (8.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page