Does InlineHilite provide default format functions like SuperFences #2531
-
I've overridden the base inline logic to my own ones InlineHiliteExtension(
custom_inline=[
{
'name': '*',
'class': 'block',
'format': variable_formatter,
},
]
def variable_formatter(source, language, css_class, md):
if language != '':
"""
调用默认格式化函数
Call the default format function.
"""
match tuple(source):
case '{', '#', *archers, '}': # 匹配到{#锚点}
archer = ''.join(archers)
return f'<span id="{archer}">{archer}</span>'
case _:
return f'<code>{source}</code>' if language has been defined, I want to call the default format function, but I only find |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can try calling the following function in your custom formatter: el = md.inlinePatterns['backtick'].handle_code(lang, src) This will find the appropriate language formatter that you wish to not handle. You could use this method to call |
Beta Was this translation helpful? Give feedback.
You can try calling the following function in your custom formatter:
This will find the appropriate language formatter that you wish to not handle.
You could use this method to call
highlight_code
instead if you know you want to call the highlighter directly.