markup icon indicating copy to clipboard operation
markup copied to clipboard

Regression in rendering restructuredText ``sourcecode`` directive

Open trevorld opened this issue 1 year ago • 2 comments

This is a refinement of #1796

Officially docutils and most other rst renderers like pandoc support three source code directives: code, code-block, and sourcecode. I'm observing that Github restored support for rendering code and code-block directives but that although it rendered the sourcecode directive for years the sourcecode code blocks are still no longer rendering correctly.

.. sourcecode:: python

  print(2 + 2)

I have a minimal github repo as an example: https://github.com/trevorld/github_rst_code_rendering

{knitr} uses the sourcecode directive when converting README.Rrst files into README.rst files so this still affects some of my repos.

Here are some links to the docutils and pandoc source code where they explictly support all three of these:

  • https://github.com/docutils/docutils/blob/ff0b419256d6b7bfdd4363dd078c2255701de605/docutils/docutils/parsers/rst/languages/en.py#L36
  • https://github.com/jgm/pandoc/blob/0c5fd01cb87c179ce8b41dead5d72b7b353d178b/src/Text/Pandoc/Readers/RST.hs#L719

trevorld avatar May 17 '24 17:05 trevorld

TicaMica1971 avatar May 29 '24 18:05 TicaMica1971

I noticed our docs looked odd as well, but luckily the workaround to replace .. sourcecode:: with .. code:: worked. Thanks for investigation @trevorld.

pekkaklarck avatar May 29 '24 19:05 pekkaklarck

Stale issue message

github-actions[bot] avatar Jul 29 '24 12:07 github-actions[bot]

Looking at https://github.com/trevorld/github_rst_code_rendering it seems that Github rendering support for the sourcecode directive has been restored.

trevorld avatar Jul 29 '24 19:07 trevorld