Giter VIP home page Giter VIP logo

Comments (2)

miyuchina avatar miyuchina commented on May 28, 2024 1

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.

miyuchina avatar miyuchina commented on May 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.