-
Notifications
You must be signed in to change notification settings - Fork 0
NPM #10
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
Comments
The function to call is unicodemathml(unicodeMath), where unicodeMath is the UnicodeMath to convert to MathML. In the program the result is usually stored in a variable t and t.mathml is the MathML corresponding to unicodeMath. You can see it used, for example, in getting MathML for the function setUnicodeMath(uMath). |
But as you can see above, the |
When I paste that expression into https://murrayiii.github.io/UnicodeMathML/playground/ I see What you see is the result when the peg parser fails to parse the UnicodeMath. Maybe the parser isn't loaded? The readme.md file (Click on About in the playground) has more details on integrating UnicodeMathML into Markdeep that should be useful for integrating it into Markdown. In the code function unicodemathml(unicodemath, displaystyle) { ... try { uast = parse(unicodemath); } catch (error) { // Display unparsable string in red uast = {unicodemath: {content: [{expr: [{colored: {color: '#F00', of: {text: unicodemath}}}]}], eqnumber: null}} autoBuildUp = false // If called for autobuildup, return failure } the error isn't displayed. Might be worth setting a breakpoint to see what it is. In https://github.com/pegjs/pegjs/blob/master/docs/guides/javascript-api.md, it has
where ₃ says: 'The format option is always set to "umd" when output is set to "parser" ' |
I added some thoughts on the issue in GitHub. Do you have a repository for integrating LaTeX and AsciiMath into Markdown? Maybe I can fiddle with your code and figure out how to incorporate the UnicodeMathML code into it. It would be super cool to have UnicodeMath as an input method for Markdown. I have been using a bunch of global variables, so that may be a problem.
Thanks,
Murray
…________________________________
From: Brian Kardell ***@***.***>
Sent: Wednesday, March 12, 2025 6:46 AM
To: MurrayIII/UnicodeMathML ***@***.***>
Cc: Murray Sargent ***@***.***>; Comment ***@***.***>
Subject: Re: [MurrayIII/UnicodeMathML] NPM (Issue #10)
[bkardell]bkardell left a comment (MurrayIII/UnicodeMathML#10)<#10 (comment)>
But as you can see above, the mathml it is returning for me is incorrect, basically unparsed and stuffed into mtext.
—
Reply to this email directly, view it on GitHub<#10 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A7GJNRT5EROR7DDW6E2VVZD2UA3CPAVCNFSM6AAAAABYWMRFGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJXHEZTSNZSGU>.
You are receiving this because you commented.
|
Most of these things use markdown-it and have a common integration strategy. You can read what I wrote here https://bkardell.com/blog/11tyMath.html It explains how to do this with 11ty, but the basic integration would work with anything that uses markdown-it (which is a lot). 11ty is a really nice way to try this out in my opinion because it is really easy to set up.... But in the end it's even more complex than we need. What we need is just a single js file that you run from the command line with nodejs
If that logs an object with actual MathML in it, we win. As I said at the top
but it didn't work. |
I’ll work on it when I return from Belgium. Thanks for the info!
Murray
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Brian Kardell ***@***.***>
Sent: Friday, March 21, 2025 8:36:15 PM
To: MurrayIII/UnicodeMathML ***@***.***>
Cc: Murray Sargent ***@***.***>; Comment ***@***.***>
Subject: Re: [MurrayIII/UnicodeMathML] NPM (Issue #10)
Most of these things use [markdown-it] and have a common integration strategy. You can read what I wrote here https://bkardell.com/blog/11tyMath.html
It explains how to do this with 11ty, but the basic integration would work with anything that uses markdown-it (which is a lot). 11ty is a really nice way to try this out in my opinion because it is really easy to set up.... But in the end it's even more complex than we need. What we need is just a single js file that you run from the command line with nodejs
/*
?? how do I get a functional unicodemathml? I'd need to import or require it...
currently that doesn't exist.
*/
console.log(unicodemathml("1+▭(⟡(1&1/2/3/4/5))"))
If that logs an object with actual MathML in it, we win.
As I said at the top
did some exploring and was able to find/modify (from peg) https://github.com/MurrayIII/UnicodeMathML/blob/main/utils/generate-parser.html#L32
but it didn't work.
—
Reply to this email directly, view it on GitHub<#10 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A7GJNRSXX5GI7LQ77Y6EN432VRS27AVCNFSM6AAAAABYWMRFGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBUGI4DEOBSHA>.
You are receiving this because you commented.Message ID: ***@***.***>
[bkardell]bkardell left a comment (MurrayIII/UnicodeMathML#10)<#10 (comment)>
Most of these things use [markdown-it] and have a common integration strategy. You can read what I wrote here https://bkardell.com/blog/11tyMath.html
It explains how to do this with 11ty, but the basic integration would work with anything that uses markdown-it (which is a lot). 11ty is a really nice way to try this out in my opinion because it is really easy to set up.... But in the end it's even more complex than we need. What we need is just a single js file that you run from the command line with nodejs
/*
?? how do I get a functional unicodemathml? I'd need to import or require it...
currently that doesn't exist.
*/
console.log(unicodemathml("1+▭(⟡(1&1/2/3/4/5))"))
If that logs an object with actual MathML in it, we win.
As I said at the top
did some exploring and was able to find/modify (from peg) https://github.com/MurrayIII/UnicodeMathML/blob/main/utils/generate-parser.html#L32
but it didn't work.
—
Reply to this email directly, view it on GitHub<#10 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A7GJNRSXX5GI7LQ77Y6EN432VRS27AVCNFSM6AAAAABYWMRFGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBUGI4DEOBSHA>.
You are receiving this because you commented.Message ID: ***@***.***>
|
I honestly didn't know which repo to open this in, so I'm just reflecting the one from doersino#5
All of the examples here are using the DOM, but most repositories that have something like this provide a simple string transformation function API where I can say something like
unicodemathml("1+▭(⟡(1&1/2/3/4/5))")
and get back a string of MathML. This makes integration with a lot of packages very easy - but I don't see anything documented about such an API. I did some exploring and was able to find/modify (from peg) https://github.com/MurrayIII/UnicodeMathML/blob/main/utils/generate-parser.html#L32 to use the formatcommonjs
, but when I call this method I getWhich is wrong. Perhaps there is a problem with my build or something?
Does such a thing exist? It would be great - I'm about to publish an article about how to embed maths in markdown with LaTex or AsciiMath - it would be super to be able to include Unicode Math if we can figure it out?
The text was updated successfully, but these errors were encountered: