from docutils import nodes
from docutils.parsers import rst
def keyboard_role(name, rawtext, text, lineno, inliner, options=None, content=None):
return [nodes.raw('', f'{text}', format='html')], []
def superscript_role(name, rawtext, text, lineno, inliner, options=None, content=None):
return [nodes.raw('', f'{text}', format='html')], []
def register_roles():
rst.roles.register_local_role('kbd', keyboard_role)
rst.roles.register_local_role('sup', superscript_role)
def register():
register_roles()