You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A long time we were searching for a solution to solve the performance problems with the Mediawiki SyntaxHightlight extension which calls python for each code block separately. Before we got completely frustrated we came across this project which solved our issue. Thank you very much for it.
To let the pymets-server run together with SyntaxHighlight we modified the main.py a bit because we needed to pass certain options (e. g. cssclass) to the pygments formatter.
To avoid such hacks which could also occur in other use cases, we suggest to add an "options" url parameter (maybe "style" should be removed then) to the pygmentize server method which then passes them into the function call of _get_formatter_by_name(alias, **options). When calling pygmetize with Python such option are passed like -O cssclass=mw-highlight,encoding=utf-8. Maybe the url could then be like this: http://server:port?lang=sql&options=cssclass%3Dmw-highlight%2Cencoding%3Dutf-8. Of course, another flexible format is also possible. Finally, the options parameter is then taken, decoded and decomposed before it is passed to the method get_formatter_by_name.
We would be very grateful if somebody comments or even works on this feature.
The text was updated successfully, but these errors were encountered:
I didn’t see this issue until just now, but I also ran into issues using pygments-server with MediaWiki’s SyntaxHighlight, and eventually decided to implement my own version that wraps pygments.cmdline rather than pygments.highlight, so that it supports all pygmentize flags and options. You can find it at lucaswerkmeister/pygments-server; maybe others find it useful as well.
A long time we were searching for a solution to solve the performance problems with the Mediawiki SyntaxHightlight extension which calls python for each code block separately. Before we got completely frustrated we came across this project which solved our issue. Thank you very much for it.
To let the pymets-server run together with SyntaxHighlight we modified the main.py a bit because we needed to pass certain options (e. g. cssclass) to the pygments formatter.
To avoid such hacks which could also occur in other use cases, we suggest to add an "options" url parameter (maybe "style" should be removed then) to the pygmentize server method which then passes them into the function call of _get_formatter_by_name(alias, **options). When calling pygmetize with Python such option are passed like -O cssclass=mw-highlight,encoding=utf-8. Maybe the url could then be like this: http://server:port?lang=sql&options=cssclass%3Dmw-highlight%2Cencoding%3Dutf-8. Of course, another flexible format is also possible. Finally, the options parameter is then taken, decoded and decomposed before it is passed to the method get_formatter_by_name.
We would be very grateful if somebody comments or even works on this feature.
The text was updated successfully, but these errors were encountered: