-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
substitute '@@' code block delimiter with triple backtick, more con… #5513
Conversation
…istent with other markdown extensions
… syntax name in codeblock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in principle. Just the test that’s failing.
I'm in the same releases matrix of https://travis-ci.org/encode/django-rest-framework/jobs/290016056 and it works on my machine. |
Hey @nastasi-oq see gem#1 (comment) I refactored the test a bit, to show the rendered markdown.
It looks like it's leaving the |
@carltongibson the point is that triple backtick is managed in any case (without pygments) as block of |
Fine. That explains that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Lets have this.
Thanks @nastasi-oq!
Hello! I had missed that one could use markdown in view docstrings to get nice code blocks, since it’s more common to have reST in the Python world, so first let me say thanks! This PR seems nice, but I can’t make it work locally. After installing markdown and pygments I tried json and javascript as lexer name, with and without leading space, with and without a blank line following. (I know reST and Sphinx very well but always forget details of Github Markdown.) Could the docs give a simple example? |
FTR: Looking at the source code, it seems like the pygments_css function is only used by the DocumentationRenderer, which only works with include_docs_url. The classic HTML API renderer has markdown code blocks without colors. |
@merwok This is because it's only just been added. A PR back porting this to the Browsable API would be welcome I guess. |
That’s interesting! I am not ready to switch to include_docs_url in my projects, so I would like to improve Browsable API. I’ll open a ticket if one isn’t already. |
Quick update: it turns out that both Documentation and Browsable renderers are quite different but both end up calling apply_markdown. The generated HTML for BrowsableAPIRenderer already contains the pygments markup, only the CSS is missing. |
…sistent with other markdown extensions
following the discussion on the previous pull request (#5462) I moved from:
to:
(that extra backslash is just so I can fool githubs markdown parsing to let me put triple backticks inside a code block marked out by triple backticks)