OliverBalfour / obsidian-pandoc

Pandoc document export plugin for Obsidian (https://obsidian.md)
MIT License
691 stars 57 forks source link

Pandoc Pre-Cleaning for Obsidian Syntax #186

Open Servinjesus1 opened 1 year ago

Servinjesus1 commented 1 year ago

I would love it if this plugin could perform the backend cleaning necessary to convert the syntaxes used for Obsidian to something of a more standard markdown flavor for use in pandoc. Certain elements are not of the markdown flavor that pandoc is used to, including:

Because of these idiosyncrasies, I find myself increasingly in need of a tool that's aware of Obsidian's direction with the markdown syntax and is able to translate the differences between Obsidian and other markdown standards for compatibility with pandoc.

Is this the intent of this plugin? If so, I have a few starting requests for the above.

For example, with Figures + Captions + Encoded Whitespace, Obsidian allows for Wiki style linking to figures with additional metadata most generally like so:

[[/Link With/Spaces.ext | Optional Alt (\label{lbl_opt}) | 128x128]]

where the optional alt text can be used for captioning (in e.g. Image Captions and LaTeX) with optional label for referencing in LaTeX, with the final element being an enforced image size (for the plugin, not sure about exports). By contrast, "Markdown" style links in Obsidian must be whitespace encoded and take on the form:

[Optional Alt (\label{lbl_opt} | 128x128](/Link%20With/Spaces.ext)

Unfortunately, neither export in pandoc correctly, so having this plugin internally translate [[Links]] or , (and, ideally also [[Unique Links]] to ) before calling pandoc would be awesome.

Sorry this is so long as it's sort of two requests in one (one on this plugin's design intent, and conditionally on this, an example implementation of this intent).

ShaddyDC commented 1 year ago

Some of that is mentioned in #145

ParkerRobb commented 1 year ago

You can use the --from=markdown+wikilinks_title_after_pipe option to take care of the wikilinks (but it doesn't work for links to headings or blocks). See the Pandoc User's Guide, p108.

ParkerRobb commented 1 year ago

I use --from=markdown+wikilinks_title_after_pipe+mark+lists_without_preceding_blankline to properly process wikilinks, highlighting, and lists without a preceding blank line. Still working on what to do about comments, callouts, and wikilinks to headings.