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

Clarify how block vs inline math should be handled #24

Open
AndersEkl opened this issue May 28, 2024 · 2 comments
Open

Clarify how block vs inline math should be handled #24

AndersEkl opened this issue May 28, 2024 · 2 comments

Comments

@AndersEkl
Copy link
Collaborator

The <math> element can be both a block or an inline element. The display attribute doesn't seem to change the actual property of the <math> element, regardless of its value, but merely affects the way the math is displayed.

Standard HTML validation allows <math display="block"> in inline contexts, even though a browser effectively handles and displays it as a block element. Some other applications, however, treat it like an actual block element. Webarch, for instance.

My suggestion is to regard <math display="block"> as a block element.

@kvile-com
Copy link

If we have:

"Did you know that
1+1=2
already?"

it should not be marked up as:

<p>Did you know that</p>
<p><math><...>1+1=2</...></math></p>
<p>already?</p>

because it might generate unwanted pauses. It should be read the same way as <p>Did you know that <math display="block"><...>1+1=2</...></math> already?</p>

@samimaattaCelia
Copy link
Collaborator

Here is also reading on how MathML should be marked up together with HTML: MathML (HTML spec). The text is a bit dense for me, but the mark up example is like what @kvile-com wrote.

The MathML code is in inside the <p> element. This also makes it possible for proper sentence structure and grammar to be used.

<h1>The quadratic formula</h1>
  <p>
   <math>
    <mi>x</mi>
    <mo>=</mo>
    <mfrac>
     <mrow>
      <mo form="prefix"></mo> <mi>b</mi>
      <mo>±</mo>
      <msqrt>
       <msup> <mi>b</mi> <mn>2</mn> </msup>
       <mo></mo>
       <mn>4</mn> <mo></mo> <mi>a</mi> <mo></mo> <mi>c</mi>
      </msqrt>
     </mrow>
     <mrow>
      <mn>2</mn> <mo></mo> <mi>a</mi>
     </mrow>
    </mfrac>
   </math>
  </p>

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

No branches or pull requests

3 participants