Reputation: 11130
Is it possible to modify the character used to denote start/end of emphasis and strong emphasis in pandoc
's markdown?
In particular, I'd like to use /emphasis/
and *strong emphasis*
.
Upvotes: 2
Views: 426
Reputation: 19867
There is no option in pandoc to customize individual pieces of markdown syntax -- you would have to write another input format for that. I think the easiest way to achieve this is to use a pre-processor that converts your custom syntax into regular markdown-strict
or markdown
syntax.
Here is one example, using filepp (there are many other options, including a sed or awk script):
#regexp /\/\b/_/
#regexp /\b\//_/
#regexp /\*\b/\*\*/
#regexp /\b\*/\*\*/
Some *bold* and some /emphasis/
To add the preprocessing step to compilation:
filepp -m regexp.pm myfile.md | pandoc ...
For instance, compiling to pandoc -t html
:
<p>Some <strong>bold</strong> and some <em>emphasis</em></p>
To make this durable save the preproc commands in their own file, let's say ~/.pandoc-pp
#regexp /\/\b/_/
#regexp /\b\//_/
#regexp /\*\b/\*\*/
#regexp /\b\*/\*\*/
And include at the top of every markdown document:
#include ~/.pandoc-pp
Upvotes: 2
Reputation: 39229
/emphasis/
is not markdown for emphasis, only *foo*
and _bar_
is... and the pandoc markdown writer currently only supports the former.
Either way, if you're asking about generating markdown; you could write a pandoc filter that replaces Emph x
with Str "/" <> x <> Str "/")
. If you're asking about taking markdown as input to pandoc, you should probably try a preprocessor as suggested by @scoa.
Upvotes: 2