Open severny-polus opened 9 months ago
Looking at the block.go
file, it seems that using <math>…</math>
is already supported?
I don't know those details off the top of my head.
Write a test and see what happens. You can start with https://tools.arslexis.io/goplayground/#txO7hJ-ibeU
Looking at this issue, I don't know what support MathML
means.
I need to see the markdown, the expected html output and what we output. And also a link to https://babelmark.github.io/ with the same markdown.
Then we can discuss if this is the right behavior and how to fix if it's not the right behavior.
I added the following test to my block_test.go
file, based on the spec:
// Inside MATH, so the other elements are passed through.
func TestMath(t *testing.T) {
input := `# Some expression
<math><mtext>2 * x</mtext></math>
`
p := NewWithExtensions(CommonExtensions)
doc := p.Parse([]byte(input))
var buf bytes.Buffer
ast.Print(&buf, doc)
got := buf.String()
exp := "Heading\n Text 'Some expression'\nHTMLBlock '<math><mtext>2 * x</mtext></math>'\n"
if got != exp {
t.Errorf("\nInput [%#v]\nExpected[%#v]\nGot [%#v]\n",
input, exp, got)
}
}
(This test, like the others, could be written data driven – right now it follows the examples in block_table_test.go
…)
Perhaps the key is that people want to remove the MathJax
option. An example like the following could be added to the documentation somewhere (this is from my own project):
extensions := (parser.CommonExtensions | parser.AutoHeadingIDs | parser.Attributes) & ^parser.MathJax
parser := parser.NewWithExtensions(extensions)
This assumes that I understand @severny-polus's issue correctly.
I might be wrong but I suppose what he means is: generate MathML
syntax from MathJax
syntax in markdown. But I'm just guessing, the request is vague.
Oof, a LaTeX to MathML converter? That's going to be super tough, I think.
It would be helpful if you add MathML support instead of MathJax. It is supported by almost all modern browsers and does not require JavaScript at all.