Skip to content
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

Code listings with include: directive are not colorized #8

Open
ptitmain opened this issue Jan 13, 2018 · 0 comments
Open

Code listings with include: directive are not colorized #8

ptitmain opened this issue Jan 13, 2018 · 0 comments

Comments

@ptitmain
Copy link

Hello
This is an old bug already present in landslide. Included a code with the include directive generates a block of code with full name of css classes instead a short names when using the code-block directive. Thus:

  • code-block => short names => colors ok
  • include => long name => colors not ok

For example:

Test
====

.. include:: test.js
   :code: javascript

.. code-block:: javascript

   const http = require('http');

Generates:

<section><pre class="code javascript literal-block">
<span class="keyword reserved">const</span> <span class="name other">http</span> <span class="operator">=</span> <span class="name other">require</span><span class="punctuation">(</span><span class="literal string single">'http'</span><span class="punctuation">);</span>
</pre>
<pre><span></span><span class="kr">const</span> <span class="nx">http</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">&#39;http&#39;</span><span class="p">);</span>
</pre></section>

The "kr" class is present in the default pygment CSS but not "keyword reserved".

A workaround is to duplicate the CSS pygment and replace each short name by a long one (or to find somewhere the default CSS in long names but I cannot find it online).

A fix would be to ask pygment to generate short names for the include directive. But maybe this is done somewhere in the docutils framework and is cannot be controlled from darkslide. I found this bug that seems to explain how to push parameters to the Html formatter object but I cannot find how to do this in the code of darkslide.

@ptitmain ptitmain changed the title Code listings include with include: directive are not colorized Code listings with include: directive are not colorized Jan 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant