Git Product home page Git Product logo

Comments (6)

pkra avatar pkra commented on June 14, 2024

Sorry hit save too early, just as I was re-writing the OP. It's been updated.

from mathjax-node.

dpvc avatar dpvc commented on June 14, 2024

I'm not sure I understand the request. The mj-page.js file already takes an HTML fragment (it doesn't have to be a full page). Perhaps you are asking for new commands in bin to take a fragment rather than a full HTML page? It turns out that this is already possible by simply passing just an HTML fragment rather than a whole page to bin/page2*. E.g.,

echo "This is some math: $x+1$" | bin/page2mml

You do get a complete page back, but that is due to how bin/page2mml works, not mj-page.js. One could certainly make a tool that separates the styles, the svg paths and the svg output, if that were desired.

So I'm really not quite sure what is being requested.

from mathjax-node.

pkra avatar pkra commented on June 14, 2024

I'm not sure I understand the request.

I don't fully either ;-) More seriously, I'm not yet sure what I'm after and if it should be part of MathJax-node. I recorded this issue primarily so that I wouldn't forget. (I ended up writing workarounds for the project that brought this up so this is not at all urgent.)

The problem I ran into with mj-page is that it modifies the page much like MathJax does (injecting styles, SVG paths etc). For use cases like processing ebooks, generic XML files, or markdown+yaml this is not ideal.

For example, processing an ebook (epub3, kf8), I'd want to collect up the css and the paths in one file each, across all xhtml files in the book (and then reference paths externally). A similar situation arises with XML files (e.g., rss, atom, but also JATS/BITS), where HTML/CSS additions would be invalid, or with markdown files with yaml preambles (e.g., for generators like Jekyll).

So I was thinking that mathjax-node could provide an API similar to mj-page but that would modify the fragment/page as little as possible, i.e., only touch the equational content (in a minimal fashion), provide a way to collect up data such as SVG paths and CSS so that they can passed on for further processing, maybe even handle several fragments (e.g., automatic equation labels).

from mathjax-node.

dpvc avatar dpvc commented on June 14, 2024

I think mj-single may be the one you want to use in this case, as it allows you to maintain state across the equations, keeping a common cache of paths, and maintaining the numbering sequence. Since you can take the equations from several files, this should allow you to keep the paths from multiple pages in a single file. The CSS is constant (I'm pretty sure), so you should be able to capture that once and not worry about it any more.

Of course, the downside here is that you have to locate the equations yourself. This can be trickier than you might think.

from mathjax-node.

pkra avatar pkra commented on June 14, 2024

Similarly to #119, I'm thinking we should build a nice collection of samples.

from mathjax-node.

pkra avatar pkra commented on June 14, 2024

Closed in favor of #206

from mathjax-node.

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.