rasendubi / uniorg

An accurate Org-mode parser for JavaScript/TypeScript
https://oleksii.shmalko.com/uniorg
GNU General Public License v3.0
256 stars 24 forks source link

astro-org's uniorgParseOptions not getting passed to uniorg-parse #74

Closed ispringle closed 1 year ago

ispringle commented 1 year ago

I'm using astro-org to parse org files to render with Astrojs. Everything is working as I expect except for the uniorgParseOptions not getting passed to the parser. This is my config for the astro-org integration:

import uniorgPlugins, { handlers } from './uniorg/index.js';
import rehypePlugins from './rehype/index.js';

export default {
    uniorgParseOptions: {
        useSubSuperscripts: '{}',
    },
    uniorgRehypeOptions: {
        handlers,
    },
    uniorgPlugins,
    rehypePlugins
};

The uniorgRehypeOptions works as expected and the handlers are all executed, but the uniorgParseOptions are not working.

Looking into the uniorg-parser and it's not apparent to me that the options are getting passed to the parser: https://github.com/rasendubi/uniorg/blob/master/packages/uniorg-parse/src/unified-org-parse.ts

ispringle commented 1 year ago

Not sure if I ought to group these two together or make another issue, but I'm also not getting super/sub script parsing. Doing a little debugging and setting some breakpoints and it seems that the regex fails to find the proper values and returns null.

rasendubi commented 1 year ago

ouch, this looks like a bug... orgParse should have a second "options" parameter and pass it down to parse function

I wonder how nobody noticed it before 🤔