Skip to content
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

Request: expose parser used for renderMarkdown #84

Open
erykwalder opened this issue Oct 9, 2022 · 3 comments
Open

Request: expose parser used for renderMarkdown #84

erykwalder opened this issue Oct 9, 2022 · 3 comments

Comments

@erykwalder
Copy link

It would be great to have access to a canonical parser for obsidian's markdown that returns the parse tree. This would really help in developing plugins that need to parse files without opening them in the editor.

Perhaps this already is exposed, just not in the public API?

@lishid
Copy link
Collaborator

lishid commented Oct 19, 2022

This is currently not exposed because the underlying parser isn't yet guaranteed to be stable and forward/backward compatible. A lot of the data structures of the parse tree solely lives in the parser component and isn't ready to be publicly documented and supported.

You do have access to a subset of the parsed data through the MetadataCache component, such as sections, links, tags, etc.

@erykwalder
Copy link
Author

Would there be any chance of it being able to be a private API but globally referenced? I think even with the here be dragons warning, it would be better than trying to maintain a parser that is compatible.

@aidenlx
Copy link

aidenlx commented Feb 14, 2023

Is it possible to bundle the the unified plugin for obsidian-favored makrdown and the unified constructor in a dedicated script and expose them in ES Module or AMD? This way workers, including obsidian parser and other metadata parser, can load them by using importScript, and custom metadata parser like dataview can write unified plugin to change AST based on obsidian-favored makrdown without re-inventing the wheel. Also this method can allow extending obsidian-favored makrdown with native parser intact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants