File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,19 @@ code_language
102102 should be annotated with `````python `` or similar.
103103 Defaults to ``'' `` (empty string) and can be any string.
104104
105+ code_language_callback
106+ When the HTML code contains ``pre `` tags that in some way provide the code
107+ language, for example as class, this callback can be used to extract the
108+ language from the tag and prefix it to the converted ``pre `` tag.
109+ The callback gets one single argument, an BeautifylSoup object, and returns
110+ a string containing the code language, or ``None ``.
111+ An example to use the class name as code language could be::
112+
113+ def callback(el):
114+ return el['class'][0] if el.has_attr('class') else None
115+
116+ Defaults to ``None ``.
117+
105118escape_asterisks
106119 If set to ``False ``, do not escape ``* `` to ``\* `` in text.
107120 Defaults to ``True ``.
You can’t perform that action at this time.
0 commit comments