I think the OP might actually want to replace literal or entity nbspaces with regular spaces. There certainly may be reasonable reasons to want to do that. I think that the OP might be helped by a prefilter written in python. The following tries to skip any fenced code or code blocks in order to not replace nbsp entities inside code. It may be thrown by things like `\~~~strikeout~~` but those are unlikely in practice. ````python import sys import re inp = sys.stdin.read() txt = inp.decode('utf-8') pat = u"""(?isxu) # Match delimited code or code block (?P (?P \`{1,} ) .*? (?P=backtick) | (?P \~{3,} ) .*? (?P=tilde) ) | # Match any form of nbsp ( \& (?: nbsp|[#]160|[#]xa0) \; | \u00a0 ) """ # keep code and replace ordinary space def rep(m): return m.group(1) if m.group(1) else u"\u0020" print re.sub(pat, rep, txt).encode('utf-8') ```` fre 4 aug. 2017 kl. 00:30 skrev Kolen Cheung : > I actually want to know why you would want to remove that in the first > place? It seems only if the source has bugs you would want to do that. > > -- > You received this message because you are subscribed to the Google Groups > "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/ > msgid/pandoc-discuss/f0bb6fae-6104-4efc-840d-34fd19b02840% > 40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhBEZ8-BdJTQRJE4M2nettrGKhf1xYzqBYs%3Dpe%3D_DAodpA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.