aboutsummaryrefslogtreecommitdiffstats
path: root/pysite/rst/__init__.py
blob: 9b2ef23c2e1a7682335ea3e3f41b06aa879298d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# coding=utf-8
from docutils.core import publish_parts
from docutils.parsers.rst.roles import register_canonical_role

from pysite.rst.roles import icon_role


def render(rst: str):
    return publish_parts(
        source=rst, writer_name="html5", settings_overrides={"halt_level": 2, "syntax_highlight": "short"}
    )["html_body"]


register_canonical_role("icon", icon_role)