Skip to content

When using CommonMarkParser code blocks do not get code highlighting #1485

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

Closed
jerel opened this issue Jul 25, 2015 · 6 comments
Closed

When using CommonMarkParser code blocks do not get code highlighting #1485

jerel opened this issue Jul 25, 2015 · 6 comments
Labels
Bug A bug

Comments

@jerel
Copy link

jerel commented Jul 25, 2015

Example:

``` python
def function():
    pass
```

renders as <pre class="literal-block"></pre> with no code styling classes applied.

highlighting

@gregmuellegger
Copy link
Contributor

CommonMark seems to do the right thing:

>>> import CommonMark
>>> parser = CommonMark.DocParser()
>>> renderer = CommonMark.HTMLRenderer()
>>> renderer.render(parser.parse("""
... ``` python
... def function():
...     pass
... ```
... """))
'<pre><code class="language-python">def function():\n    pass\n</code></pre>\n'

But you are referencing python code in the ticket description and show JSON output in the screenshot. Could you give us a link to the page where the rendering breaks for you?

@gregmuellegger gregmuellegger added the Needed: more information A reply from issue author is required label Jul 27, 2015
@jerel
Copy link
Author

jerel commented Jul 27, 2015

Sure, here is a link to the docs page http://django-rest-framework-json-api.readthedocs.org/en/latest/usage.html#configuration I suppose CommonMark is doing what it is supposed to do but its output differs from the rst code blocks so there's no highlighting style in the readthedocs.org theme.

Also note that the Edit on Github button on the page I linked to has .rst hardcoded so returns a 404 for .md. Here's the correct link https://github.com/django-json-api/django-rest-framework-json-api/blob/develop/docs/usage.md

@ericholscher
Copy link
Member

Support for this was just merged into our upstream, and should be pushed to
RTD with a new release of recommonmark:
https://github.com/ericholscher/recommonmark/pull/1

On Mon, Jul 27, 2015 at 8:41 AM, Jerel Unruh [email protected]
wrote:

Sure, here is a link to the docs page
http://django-rest-framework-json-api.readthedocs.org/en/latest/usage.html#configuration
I suppose CommonMark is doing what it is supposed to do but its output
differs from the rst code blocks so there's no highlighting style in the
readthedocs.org theme.

Also note that the Edit on Github button on the page I linked to has .rst
hardcoded so returns a 404 for .md. Here's the correct link
https://github.com/django-json-api/django-rest-framework-json-api/blob/develop/docs/usage.md


Reply to this email directly or view it on GitHub
#1485 (comment)
.

Eric Holscher
Maker of the internet residing in Portland, Oregon
http://ericholscher.com

@gregmuellegger
Copy link
Contributor

That commit fixed it readthedocs/recommonmark@4005ba5
@ericholscher when will a new release happen?

@gregmuellegger gregmuellegger added Bug A bug and removed Needed: more information A reply from issue author is required labels Jul 30, 2015
@ericholscher
Copy link
Member

Just released 0.2.0 of recommonmark and updated our dep. It will be resolved with next deploy.

@jerel
Copy link
Author

jerel commented Jul 31, 2015

Thanks so much guys. It looks very nice now with markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug
Projects
None yet
Development

No branches or pull requests

3 participants