Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When copy and convert html to markdown, how to include latex in markdown? #57

Open
Norlandz opened this issue Nov 13, 2024 · 0 comments

Comments

@Norlandz
Copy link

Norlandz commented Nov 13, 2024

For example

Given a website with html:

<div>
  Define the Function: Let
  <math xmlns="http://www.w3.org/1998/Math/MathML">
    <mrow>
      <mi>f</mi>
      <mo stretchy="false">(</mo>
      <mi>x</mi>
      <mo stretchy="false">)</mo>
      <mo>=</mo>
      <msup>
        <mi>x</mi>
        <mn>2</mn>
      </msup>
    </mrow>
  </math>
  , which has a <strong>derivative</strong>
  <math xmlns="http://www.w3.org/1998/Math/MathML">
    <mrow>
      <msup>
        <mi>f</mi>
        <mo rspace="0em" lspace="0em" mathvariant="normal"></mo>
      </msup>
      <mo stretchy="false">(</mo>
      <mi>x</mi>
      <mo stretchy="false">)</mo>
      <mo>=</mo>
      <mn>2</mn>
      <mi>x</mi>
    </mrow>
  </math>
  .
</div>

When I copy & convert the html to markdown.

I want to include latex in markdown:

Define the function: Let $$ f(x) = x^2 $$, which has a **derivative** $$ f'(x) = 2x $$.

For clarification in case people dont know how latex works in html:

It is common to use latex in markdown. (eg: in RStudio, Ipynb, etc)
You can try to use https://upmath.me/ as online demo to see how it parses the latex in markdown.

The html I provided uses MathML for rendering formulas (latex),
so the whole point is to: Convert MathML code to Latex code.
Which is something very common, there should be many lib able to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants