Comments (1)
Mmh no @fthuin, this worked out of the box for me without issues. The only thing I see is that your code block is only intended with two spaces, but I think reStructuredText requires 4 spaces. (Though I would not think that would draw 'pygments not found'.)
Let me show you how I tested it, it might help you.
~/Workspace/django-markup master+$ pip install -U docutils pygments
Requirement already up-to-date: docutils
Requirement already up-to-date: pygments
~/Workspace/django-markup master+$ pip list
Django (1.11.1)
docutils (0.14)
Pygments (2.2.0)
...
~/Workspace/django-markup master+$ manage.py shell
Python 2.7.13 (default, Apr 3 2017, 18:57:07)
In [1]: from django_markup.markup import formatter
In [2]: text = '''
...: Some **rST** text.
...:
...: .. code-block:: python
...:
...: def test():
...: return 'Hello World'
...: '''
In [3]: formatter(text, filter_name='restructuredtext')
Out[3]: u'<div class="document">\n<p>Some <strong>rST</strong> text.</p>\n<pre class="code python literal-block">\n<span class="keyword">def</span> <span class="name function">test</span><span class="punctuation">():</span>\n <span class="keyword">return</span> <span class="literal string single">\'Hello World\'</span>\n</pre>\n</div>\n'
~/Workspace/django-markup master+$ manage.py shell
Python 3.6.1 (default, Apr 29 2017, 22:13:10)
In [1]: from django_markup.markup import formatter
In [2]: text = '''
...: Some **rST** text.
...:
...: .. code-block:: python
...:
...: def test():
...: return 'Hello World'
...: '''
In [3]: formatter(text, filter_name='restructuredtext')
Out[3]: '<div class="document">\n<p>Some <strong>rST</strong> text.</p>\n<pre class="code python literal-block">\n<span class="keyword">def</span> <span class="name function">test</span><span class="punctuation">():</span>\n <span class="keyword">return</span> <span class="literal string single">\'Hello World\'</span>\n</pre>\n</div>\n'
from django-markup.
Related Issues (20)
- Using images? HOT 1
- reST filter doesn't render header levels 1 & 2 HOT 2
- vulnerable XSS django-markup HOT 1
- remove blockquote to [HTML_REMOVED] HOT 1
- Issue on MarkupFormatter HOT 2
- Styling of generated code/markup via CSS/pygments HOT 4
- Automatically higlight links HOT 1
- Add support for Org-Markup HOT 1
- Bleach whitelist dependency error HOT 2
- All filter dependencies not available in 1.4 HOT 3
- bleach_whitelist is missing `<pre>` from the markup list HOT 2
- No module named 'bleach_whitelist' HOT 2
- Code blocks is not rendered correctly HOT 4
- setting “python_requires” with ">=3.7" is a better way to declare Python compatibility
- Missing git tag for the 1.6 release HOT 1
- Test failure with pygments 2.14.0 HOT 2
- Cannot Use Django 3.2 With django-markup 1.7.1 HOT 3
- Any chance of a new release? HOT 6
- url qoute needed HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-markup.