Reputation: 104539
For my program, I have a markdown document that I use to produce both a Unix man page as well as a plain text document.
pandoc -s -w plain -o program.txt program.md
pandoc --no-wrap -s -w man -o program.1 program.md
The content in the markdown with double asterisks (e.g. **foobar**
) is used to express emphasis results in bold text in the man page. But in the text output, it results in UPPER CASE.
For example:
echo '**foobar**' | pandoc -w plain
results in:
FOOBAR
But I'd rather it ignore the emphasis tagging and just output foobar
in the plain text output.
The best I've been able to come up with is to use a sed
expression to strip out all the emphasis tags:
cat program.md | sed s/\*\*//g | pandoc --no-wrap -s -w plain -o program.txt
Is there a more formal way to do this?
Upvotes: 2
Views: 403
Reputation: 1101
You want to use a Pandoc filter that converts strong text to normal text when outputting to pain text.
There is a filter that does just this: https://github.com/sergiocorreia/panflute-filters/blob/master/filters/remove-strong.py
(It uses Panflute so you need to pip install panflute
, and have python 2.7+ installed)
You also may to replace this line:
if isinstance(elem, pf.Strong)
With this one:
if isinstance(elem, pf.Strong) and doc.format=='plain'
(Or just run the filter only for text output!)
Upvotes: 3