How to use the cmarkgfm._cmark.ffi.NULL function in cmarkgfm

To help you get started, we’ve selected a few cmarkgfm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github theacodes / cmarkgfm / src / cmarkgfm / cmark.py View on Github external
def render_html(root, options=0, extensions=None):
    """Render a given syntax tree as HTML.

    Args:
        root (Any): The reference to the root node of the syntax tree.
        options (int): The cmark options.
        extensions (Any): The reference to the syntax extensions, generally
            from :func:`parser_get_syntax_extensions`

    Returns:
        str: The rendered HTML.
    """
    if extensions is None:
        extensions = _cmark.ffi.NULL

    raw_result = _cmark.lib.cmark_render_html(
        root, options, extensions)

    return _cmark.ffi.string(raw_result).decode('utf-8')
github theacodes / cmarkgfm / src / cmarkgfm / cmark.py View on Github external
def find_syntax_extension(name):
    """Direct wrapper over cmark_find_syntax_extension."""
    encoded_name = name.encode('utf-8')
    extension = _cmark.lib.cmark_find_syntax_extension(encoded_name)

    if extension == _cmark.ffi.NULL:
        return None
    else:
        return extension