This PR adds a getParser() function to unified-latex-util-parse package.
This PR partially resolve the issue in #32 . The actual use case is that, it seems not possible to avoid directly importing unifiedjs when trying to pass plugin options of unifiedLatexFromString to the parser. When working on platforms without ESM support (e.g., electron), this becomes almost impossible to customize the LaTeX parser.
This PR adds a
getParser()
function tounified-latex-util-parse
package.This PR partially resolve the issue in #32 . The actual use case is that, it seems not possible to avoid directly importing
unifiedjs
when trying to pass plugin options ofunifiedLatexFromString
to the parser. When working on platforms without ESM support (e.g., electron), this becomes almost impossible to customize the LaTeX parser.With this new function, user can indirectly invoke the
use()
ofunified
to create a LaTeX parser with custom macros and envs. A possible use case is illustrated at https://github.com/James-Yu/LaTeX-Workshop/blob/unified-latex/src/components/parser.ts#L163-L200 .This PR will have full effect with another PR shortly on bundling ESM dependencies when creating
.cjs
distributions.