Tag pandoc
2 bookmarks have this tag.
2 bookmarks have this tag.
Starting with version 1.6, pandoc can produce output in the EPUB electronic book format. EPUB books can be viewed on iPads, Nooks, and other electronic book readers, including many smart phones. (They can also be converted to Kindle books using the GUI only KindlePreviewer on Windows and Mac OSX. KindleGen – which offers a command line interface and supports Linux, Mac OSX and Windows – has been deprecated, but binaries can still be found on the internet.)
Obsidian callout blocks are not part of the Pandoc Markdown syntax. But since they are kind of extended block quote syntax, you can write a Pandoc Lua filter 76 to convert them to anything you want.
Below a quick-and-dirty solution which converts Obsidian callout blocks
> [!NOTE]- Note Title
>
> Note content
to Pandoc’s native Divs
::: {.callout data-callout="note" title="Note Title"}
Note content
:::
with the following Pandoc command:
pandoc -t markdown --lua-filter obsidian-callouts.lua file.md
Important: Please note, that in order for this simple filter to work properly, callout type and title line should occupy a separate paragraph.
Here the content of the obsidian-callouts.lua file:
local stringify = (require "pandoc.utils").stringify
function BlockQuote (el)
start = el.content[1]
if (start.t == "Para" and start.content[1].t == "Str" and
start.content[1].text:match("^%[!%w+%][-+]?$")) then
_, _, ctype = start.content[1].text:find("%[!(%w+)%]")
el.content:remove(1)
start.content:remove(1)
div = pandoc.Div(el.content, {class = "callout"})
div.attributes["data-callout"] = ctype:lower()
div.attributes["title"] = stringify(start.content):gsub("^ ", "")
return div
else
return el
end
end
You can modify it to convert callout blocks depending on the output format (HTML, LaTeX, etc.)