obsidian-api
obsidian-api copied to clipboard
Request: expose parser used for renderMarkdown
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?
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.
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.
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.