Comments (2)
I love the idea. And yes, complete LaTeX support is definitely a thing I will be aiming for down the road.
The main hurdle for this, as I see it, is that as of this moment mistletoe only supports LaTeX elements when rendering to LaTeX. A current working example is LaTeX's inline math elements.
If I understand your proposal correctly, you seem to want LaTeX elements to be rendered into HTML. I also have this goal in mind, but doing so would involve some important design changes, of which I am not sure of the implications. Not saying that this can't be done -- I will probably open a branch and see what I can do -- but it certainly involves some careful planning.
Meaning that anyone could contribute a PR to do this
... by all means, please hack around, give a feature example and open a PR.
Thanks for this!
from mistletoe.
Well it's actually easier than I expected. Take a look at the mathjax module under plugins
: it should provide some rudimentary support for MathJax's syntax.
If you want math enclosed in parenthesis or brackets, you need to escape it twice: \\(1 + 1 = 2\\)
. Similarly with \def
or macros, write it like this amidst your Markdown:
\\(
\def\RR{\bf R}
\def\bold#1{\bf #1}
\\)
\\( \RR \\)
now gives you a bold-faced "R". To use MathJaxRenderer
:
from plugins.mathjax import MathJaxRenderer
with open('foo.md', 'r') as fin:
rendered = mistletoe.markdown(fin, MathJaxRenderer)
It does not support local packages, however, and I'm sure I haven't considered all the corner cases. But try it out, and let me know if there's something bugging you in particular.
I may try to integrate it more closely with mistletoe's core components, but that's for another issue.
Cheers!
from mistletoe.
Related Issues (20)
- Support of Smart punctuation / Simple typographic replacements HOT 3
- 0.8.2: pytest is failing in `test/test_contrib/test_github_wiki.py::TestGithubWiki::test_parse` unit and `DeprecationWarning` warnings HOT 5
- Record line numbers on tokens HOT 6
- Unused imports HOT 1
- question: how to render AST back to a markdown string HOT 1
- LaTeX renderer does not handle inline code with vertical bars correctly HOT 2
- pikchr integration? HOT 1
- Question: Inconsistencies in the block tokens HOT 2
- Enable tables which interrupt a paragraph (like GFM does) HOT 5
- IndexError on malformed markdown tables HOT 1
- Emphasis around link ignored when followed by a special punctuation character HOT 1
- Don't convert the quotes HOT 3
- Contrib sub-package is missing in the mistletoe 1.0.0 PyPI version HOT 3
- Question how to modify ast and write back out as markdown HOT 2
- Do not escape double or single quotes by default HOT 1
- Use strict PascalCase for class names HOT 3
- Renderer for Natural Docs HOT 6
- How to add a custom token inside a block token? HOT 1
- How to add a custom token inside a block token? HOT 3
- make output markdown keep original indentation of the 1st line in a list item
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 mistletoe.