Support pandoc line blocks

Please add support for pandoc line blocks.

Use case or problem

When adding text that requires spaces at the start of lines to be retained - such as formatting poetry - these are removed in preview mode.

Proposed solution

Use pandoc line blocks. These use | at the start of lines to signify that all white space at the start should be retained.

Example -

|So a poem,
|    With idents,
|    Can be formated,
|        Correctly,

Current workaround (optional)

It would be possible to do similar using a CSS snippet and a fenced code block or using <div> tags. However, in editor mode neither look good. Also, using CSS snippets on code blocks is a bit of a hacky solution - and it’d be better to retain a markdown style syntax than switching to html.

Related feature requests (optional)

This is similar to my other feature request - Support pandoc fenced divs. In genereal, I think it would be good to adopt pandoc flavoured markdown and extensions. Pandoc is widely used and supported so adding it retains interoperability with other software.

3 Likes

I totally agree. I use Pandoc to produce installation instructions, papers, slide shows and even books from Markdown (using LaTeX).

It’s bad enough having to post-process wiki links back to Markdown links, but considering Obsidian turns out to be the PKM solution (at least for me), more support for Pandoc Markdown would just be great!

3 Likes

@Moonbase59

May I ask, how do you convert wiki links to Markdown links? Do you use a pandoc filter or some kind of regex replacement tool?

To be honest: I don’t know yet. But I tried very simple (manual, folder-based) regex replacement.

I’m quite new to Obsidian, and I like it a lot. Even the wiki links, since they feel more natural and span the whole vault. I also love the “suggestion window” when starting a link with [[.

So this is my problem:

Previously, I wrote my documents in (folder-based) Markdown files, using Markdown links. This worked well, I could use my bibtex files, Pandoc, and LaTeX easily.

But Obsidian doesn’t offer all the niceties when setting it to “Markdown links” (instead of wiki links). So I switched to wiki links, which in turn don’t work with most external tools (My usual workflow: Pandoc → LaTeX → PDF or Pandoc → Ebook).

I have no idea yet on how to expand all wiki links correctly—they look simple but could reference a file in a different (sub-)folder.

Maybe some kind of export plugin would be needed, because the “real” links are hidden somewhere in the database. (But keeping redundant Markdown copies violates DRY (don’t repeat yourself).)

Maybe I’ve missed it, but I’d like some method to “do it all” within Obsidian—export using Markdown links, feed and run Pandoc/LaTeX and produce perfect PDFs, i.e. Linux commandline scripting within Obsidian, much like I have in Atom or Ghostwriter (which I both used before).

It all boils down to bringing research/thinking and output production together:

  • Obsidian gives me much of what I missed before: Structured thinking and linking, atomic notes and great search.
  • Pandoc and LaTeX are my tools for generating the desired output (PDF and/or ebooks).

Sorry for the looong explanation—must learn to keep it shorter …