nene icon indicating copy to clipboard operation
nene copied to clipboard

Add syntax highlighting support for code blocks

Open leouieda opened this issue 3 years ago • 0 comments

With the change to markdown-it-py (#28), we can now add a custom rendering rule for code blocks (the ones with tripple-backticks) that replaces the code block with the rendered version from Pygments (see https://pygments.org/docs/quickstart/). This should be done in markdown_to_html in nene/rendering.py.

Note that this would only add the proper tags and classes without any inline styles. The actual style definitions would come from CSS stylesheets that the user must include in their templates. See https://pygments.org/styles/ for available styles which can be exported to CSS using the command line https://pygments.org/docs/cmdline/#generating-styles.

leouieda avatar Apr 12 '22 09:04 leouieda