2013-04-15 96 views

回答

2

你可以寫一個短的Haskell程序unescape.hs:

-- Disable backslash escaping of special characters when writing strings to markdown. 
import Text.Pandoc 

main = toJsonFilter unescape 
    where unescape (Str xs) = RawInline "markdown" xs 
     unescape x  = x 

現在用ghc --make unescape.hs編譯。並與

pandoc -f html -t json | ./unescape | pandoc -f json -t markdown 

這將使用禁用的降價輸出的特殊字符(如$)逃逸。

更簡單的方法可能是管道pandoc的正常降價輸出通過sed的:

pandoc -f html -t markdown | sed -e 's/\\\([$^_*]\)/\1/g' 
+0

謝謝您的回答。簡單的正則表達式似乎工作正常。但是,如果將markdown與mathjax結合使用,則可以使用\ begin {align \ *}來轉義asterix – Ben

相關問題