Skip to content

NPM #10

@bkardell

Description

@bkardell

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 format commonjs, but when I call this method I get

{
  mathml: '<math display="block"><mstyle mathcolor="#F00"><mtext>⁅1+▭(⟡(1&1/2/3/4/5))⁆</mtext></mstyle></math>',
  details: {
    measurements: {
      parse: 0.20350000000001955,
      preprocess: 0.6372080000000437,
      transform: 0.584541999999999,
      pretty: 0.10495800000001054
    },
    intermediates: {
      parse: [Object],
      preprocess: [Object],
      transform: [Object],
      json: '{"unicodemath":{"content":[{"expr":[{"colored":{"color":"#F00","of":{"text":"⁅1+▭(⟡(1&1/2/3/4/5))⁆"}}}]}],"eqnumber":null}}'
    }
  }
}

Which 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions