Comments (3)
Thanks for the feature request. The bad news is that I have no current plan to actively add support for non-standard extensions. The good news is that I would gladly accept pull requests for it!
If you are interesting in making a pull request, I am absolutely willing to give you a few pointers if you get stuck.
from restbuilder.
Thanks for the info. I'd love to contribute but I am afraid I really would not know where to start!
from restbuilder.
Just passing by but I think this is relatively straightforward to resolve, probably with just a little hack in your own project's conf.py
:
Problem
- The root cause here is that the
.. mermaid
directive isn't recognized by docutils unless it's registered as a node class - The
sphinxcontrib.mermaid
extension adds a node using sphinx'sadd_node
API in thesphinxcontrib.mermaid
's setup() function, which is abbreviated below:
[...]
class mermaid(nodes.General, nodes.Inline, nodes.Element):
pass
def html_visit_mermaid(self, node):
render_mm_html(self, node, node['code'], node['options'])
[...]
def setup(app):
app.add_node(mermaid,
html=(html_visit_mermaid, None),
latex=(latex_visit_mermaid, None),
texinfo=(texinfo_visit_mermaid, None),
text=(text_visit_mermaid, None),
man=(man_visit_mermaid, None))
- In the above, nodes are added for each builder name in the
**kwargs
(iehtml
is for thehtml
builder) - If you are rolling out your own builder in an extension, you would need to have an
add_note(mermaid, yourbuilder=(html_visit_mermaid, None))
call added to theapp
Example Solve
- The solve is relatively straightforward: just register a node for the builder name
- It's possible to add this into a local project's extension's
setup(app)
such as:
from sphinx.util import logging
def setup(app):
if 'sphinxcontrib.mermaid' in app.config.extensions:
try:
from sphinxcontrib.mermaid import html_visit_mermaid, mermaid
app.add_node(
mermaid,
somebuilder=(html_visit_mermaid, None),
)
except ImportError:
logging.getLogger(__name__).error(
"sphinxcontrib.mermaid was detected in conf.py extensions=[...] "
"but we were unable to import html_visit_mermaid from to run app.add_node(mermaid)."
)
from restbuilder.
Related Issues (20)
- Column or row spanning cells are not implemented HOT 1
- versionlabels moved from sphinx.locale to sphinx.domains.changeset HOT 12
- Preserve code blocks HOT 2
- KeyError: 'name' HOT 2
- An option to create fully qualified links HOT 4
- Upload latest fixes to pip ? HOT 2
- Support for `:ref:` links
- Line numbers in code blocks HOT 1
- Bulleted lists aren't indented optimally HOT 3
- Images associated with substitution references are lost HOT 9
- Support math expressions HOT 4
- nested list bug: missing line breaks with compact_paragraph HOT 3
- Bring restbuilder up-to-date: seeking maintainer HOT 10
- restbuilder fails with URL
- 0.3: pytest is failing HOT 3
- static images missing?
- Enable discussions HOT 4
- Error rendering image directive HOT 3
- Rename sphinxcontrib.restbuilder to sphinx-rst-builder HOT 1
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 restbuilder.