code and code-block directives are rendered on the commandline, but not online.
% python rest2html reST-block-ghdemo.rst
file testcase reST-block-ghdemo.rst:
testing reST blocks
.. code-block::
@a = "using code-block"
puts @a
.. code-block:: ruby
@a = "using code-block ruby"
puts @a
.. code::
@a = "using code"
puts @a
.. code:: ruby
@a = "using code ruby"
puts @a
::
@a = "using literal block (no syntax sugar)"
puts @a
- http://sphinx.pocoo.org/markup/code.html#line-numbers
- http://sphinx.pocoo.org/rest.html#source-code
- http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#literal-blocks
ah, looks like it was added after version 0.8.1:
diff --git a/en.py b/en.py
index 9bdf154..0cbfc78 100644
--- a/en.py
+++ b/en.py
@@ -1,4 +1,4 @@
-# $Id: en.py 6460 2010-10-29 22:18:44Z milde $
+# $Id$
# Author: David Goodger <[email protected]>
# Copyright: This module has been placed in the public domain.
@@ -19,6 +19,9 @@ directives = {
# language-dependent: fixed
'attention': 'attention',
'caution': 'caution',
+ 'code': 'code',
+ 'code-block': 'code',
+ 'sourcecode': 'code',
'danger': 'danger',
'error': 'error',
'hint': 'hint',
@@ -75,6 +78,7 @@ roles = {
'ab': 'abbreviation',
'acronym': 'acronym',
'ac': 'acronym',
+ 'code': 'code',
'index': 'index',
'i': 'index',
'subscript': 'subscript',
It would be awesome if this could be added into the online github flavored markup. I would guess it would be dead-simple to do, since it's almost exactly the same format as the syntax for GFM.
markdown
```python
import this
```
vs.
.. code:: python
import this
Is an upgrade to their version of docutils coming soon?
github.com now includes latest docutils, so we do correctly render rSt on the site. :metal:
Too bad syntax highlighting is not supported :(
Correction: it doesn't work only in wiki (unless I did something stupid)
It should be fairly trivial to rewrite the pre blocks that are generated by docutils to the github tripple backtick format, i'll have a go and submit the patch to gollum.
Bump, did this ever... umm get implemented?
I tried, it wasn't simple, I ran out of time, so probably not.
It actually works, I just did this in a .rst in a repo and it doesn't show it in the preview but will show it in the final rendered form:
.. code:: javascript
function whatever() {
return "such color"
}
Regression: .. code-block and .. code directives not working.
Having tried this just now, can confirm that neither .. code-block, nor .. code are working. Tried any possible permutation of the official docs, but still nothing.
@kot-behemoth, the syntax-highlighting regression seems to have been fixed as of Dec 2016... for example, see https://github.com/mpenning/clijockey
Most helpful comment
Having tried this just now, can confirm that neither
.. code-block, nor.. codeare working. Tried any possible permutation of the official docs, but still nothing.