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

Mathml and epub : missing xmlns and xml-annotation #345

Open
artragis opened this issue Jul 28, 2019 · 1 comment
Open

Mathml and epub : missing xmlns and xml-annotation #345

artragis opened this issue Jul 28, 2019 · 1 comment
Labels
blocked/upstream Awaiting for upstream changes semver/minor This is a backward-compatible change status/verified This has been checked by a maintainer type/request This is great to have

Comments

@artragis
Copy link
Member

When we process math with KaTeX for epub we output something like this :

<span class="inlineMath">
      <span class="katex">
       <span class="katex-mathml">
        <math>
         <semantics>
          <mrow>
           <mfrac>
            <mrow>
             <mi>
              N
             </mi>
             <mo>
              ×
             </mo>
             <mo>
              (
             </mo>
             <mi>
              N
             </mi>
             <mo>
              +
             </mo>
             <mn>
              1
             </mn>
             <mo>
              )
             </mo>
            </mrow>
            <mn>
             2
            </mn>
           </mfrac>
          </mrow>
          <annotation>
           \frac {N \times (N+1)} {2}
          </annotation>
         </semantics>
        </math>
       </span>
       <span class="katex-html">
        <span class="base">
         <span class="strut" style="height:1.355em;vertical-align:-0.345em;">
         </span>
         <span class="mord">
          <span class="mopen nulldelimiter">
          </span>
          <span class="mfrac">
           <span class="vlist-t vlist-t2">
            <span class="vlist-r">
             <span class="vlist" style="height:1.01em;">
              <span style="top:-2.6550000000000002em;">
               <span class="pstrut" style="height:3em;">
               </span>
               <span class="sizing reset-size6 size3 mtight">
                <span class="mord mtight">
                 <span class="mord mtight">
                  2
                 </span>
                </span>
               </span>
              </span>
              <span style="top:-3.23em;">
               <span class="pstrut" style="height:3em;">
               </span>
               <span class="frac-line" style="border-bottom-width:0.04em;">
               </span>
              </span>
              <span style="top:-3.485em;">
               <span class="pstrut" style="height:3em;">
               </span>
               <span class="sizing reset-size6 size3 mtight">
                <span class="mord mtight">
                 <span class="mord mathdefault mtight" style="margin-right:0.10903em;">
                  N
                 </span>
                 <span class="mbin mtight">
                  ×
                 </span>
                 <span class="mopen mtight">
                  (
                 </span>
                 <span class="mord mathdefault mtight" style="margin-right:0.10903em;">
                  N
                 </span>
                 <span class="mbin mtight">
                  +
                 </span>
                 <span class="mord mtight">
                  1
                 </span>
                 <span class="mclose mtight">
                  )
                 </span>
                </span>
               </span>
              </span>
             </span>
             <span class="vlist-s"></span>
            </span>
            <span class="vlist-r">
             <span class="vlist" style="height:0.345em;">
              <span>
              </span>
             </span>
            </span>
           </span>
          </span>
          <span class="mclose nulldelimiter">
          </span>
         </span>
        </span>
       </span>
      </span>
     </span>

For epub, the interresting part is only

 <span class="katex-mathml">
        <math>
         <semantics>
          <mrow>
           <mfrac>
            <mrow>
             <mi>
              N
             </mi>
             <mo>
              ×
             </mo>
             <mo>
              (
             </mo>
             <mi>
              N
             </mi>
             <mo>
              +
             </mo>
             <mn>
              1
             </mn>
             <mo>
              )
             </mo>
            </mrow>
            <mn>
             2
            </mn>
           </mfrac>
          </mrow>
          <annotation>
           \frac {N \times (N+1)} {2}
          </annotation>
         </semantics>
        </math>
       </span>

The problem is :

  • the math tag is missing xmlns="http://www.w3.org/1998/Math/MathML" attribute (not mandatory, most of readers include it automaticaly
  • the <semantics> tags is missing a xml-annotation element like specified here.
@StaloneLab
Copy link
Member

Tested on standalone parser/serializer, the problem is the same:

remark-math does his job => rehype-katex passes directly to => katex where the problems are actually located

About the missing xmlns attribute, it will be in the next release of KaTeX, so we just need to wait for it to be updated on both rehype-katex and zds-site.

I opened an issue concerning the xml-annotation element, but we can't do much ourselves, so do we keep this issue open until addition of theses features on the dependencies?

@StaloneLab StaloneLab added blocked/upstream Awaiting for upstream changes semver/minor This is a backward-compatible change status/verified This has been checked by a maintainer type/request This is great to have labels Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/upstream Awaiting for upstream changes semver/minor This is a backward-compatible change status/verified This has been checked by a maintainer type/request This is great to have
Projects
None yet
Development

No branches or pull requests

2 participants