[REQUEST] Default syntax rendering for inline code using Markdown
See original GitHub issueNo similar issue: I have checked and did not see a similar feature request in any issue (open or close) with the word “code”.
How would you improve Rich?
It would be nice if inline markdown code, like this
, could be rendered by pygments in a default theme+language (lexer) for consistency with the way that code blocks are rendered instead of in a uniform style defined by markdown.code
.
What problem does it solved for you?
In one of my project (friendly-traceback), I use code-blocks to show where an exception was raised. I then add some text, explaining the source of the problem, in which either single identifiers or parts of a line of code are inserted in a phrase using single backticks to identify as code. The lack of consistency in styling is less than ideal.
Note: I have looked at rich’s own code to see if I could monkeypatch it (which I do for some other things in my project) and could not find an easy way to do what I would like it to do. I’ve also used markdown with Sphinx, which uses Python as a default for code blocks and found that it too was not rendering inline code as Python code with the appropriate pygments theme. As far as I could tell, it does not look like something that would be easy to do and would completely understand if this issue would be closed with “won’t fix”. However, if it looks like it might be possible to monkeypatch rich (and/or commonmark?) to do this, I would appreciate if I could get some pointers as I would be willing to experiment further on my own.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top GitHub Comments
v6.2.0 has inline code highlighting in Markdown. Set
inline_code_lexer="python"
on the Markdown constructor to enable it…Thanks! I’ve been really busy with my day job (as a new Academic Year begins at our university) and have not had time to look at this. I really appreciate that you are tackling it.