Giter Club home page Giter Club logo

Comments (3)

benrbray avatar benrbray commented on May 18, 2024

I started to implement pasting of math from Wikipedia using a custom ProseMirror ParseRule (and the .getContent property), but ran into some unexpected behavior where the pasted math nodes all come up empty. I started a question on the ProseMirror forum which will hopefully resolve the issue.

from prosemirror-math.

benrbray avatar benrbray commented on May 18, 2024

This website has math rendered using Madoko, which renders math and diagram SVGs server-side and includes them the following format:

<svg class="snippet math-display math-render-svg math" data-math-full="true" style="..." viewBox="...">
    <desc>\begin{tikzpicture}
    \matrix[nodes={draw}, row sep=0.3cm,column sep=0.5cm] {
      \node [rectangle, draw=none] (eq) {$a = b, b = c, d = e, b = s, d = t: $};&
      \node [circle, draw] (abcs) {$a, b, c, s$}; &
      \node [circle, draw] (det) {$d, e, t$}; \\
    };
    \end{tikzpicture}
    </desc>
    <g id="math-a6e187">...</g>
</svg>

This example contains an SVG rendering of a tikz diagram, which is obviously problematic for KaTeX, which is the current default. Once MathJax is supported, an extension like TikzJax can be used to render diagrams.

UPDATE: It won't be possible to paste from documents rendered with Madoko. The TeX source is contained in a <desc> tag within an SVG element, and apparently the <desc> tags are stripped away in both Chrome and Firefox when copying.

from prosemirror-math.

benrbray avatar benrbray commented on May 18, 2024

UPDATE: StackExchange keeps its TeX code in <script type="math/tex"> tags, but these are stripped away when copying for security reasons. To copy from StackExchange, we'll need to parse the MathML directly.

from prosemirror-math.

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.