How exactly is the math tag used in Elm?

Here is just a general div with some pointless math. Not displayed correctly

div [] [ math [] [text "$\\int_a^b \frac{2}{3}$"]

and that's what comes out

<math>$\int_a^b \frac{2}{3}$</math>

therefore, I don’t understand how mathElm works. It looks like mathML

Currently, I find it easier to make a mathjax call than to learn (or create) a new markup language and write pure math. That's what it should look like

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <msubsup>
    <mo>&#x222B;<!-- ∫ --></mo>
    <mi>a</mi>
    <mi>b</mi>
  </msubsup>
  <mfrac>
    <mn>2</mn>
    <mn>3</mn>
  </mfrac>
</math>

Elm does not have a tag mfrac, but I would be happy to write in my own! This tag set is being used on the Internet with increasing frequency, but may not yet have been adopted by Elm-Lang himself.


Elm creates nodewhere you can define your own tag of any type.

node
    :  String
    -> List (Attribute msg)
    -> List (Html msg)
    -> Html msg

This indicated a potential solution. Nothing resulted:

node "math" [] [ node "mo" [] [ text "&#x222B;"] ]
+4
2

Html.node html .

view model =
  math []
    [ node "msup" []
      [ node "mi" [] [ text "x" ]
      , node "mn" [] [ text "2" ]
      ]
    ]

,   node .

+1

MathML Safari Firefox, Html.node MathML - .

polyfill, KaTeX MathJax.

, KaTeX , MathJax, Elm.

bsouthga/elm-katex LaTeX Elm. elm-github-install, .

, CSS KaTeX

+1

Source: https://habr.com/ru/post/1663025/


All Articles