从Emacs在Markdown中渲染unicode字符 [英] Rendering unicode characters in Markdown from Emacs
问题描述
我有一个具有utf-8编码的Markdown文本文件,其中包含一些非ASCII字符,例如'
。我无法获得Perl的参考,以正确处理这些字符,但我可以让它与Pandoc一起工作。我想要从Emacs直接呈现我的Markdown文件,使用 Cc Cc p -mode /rel =nofollow> Markdown模式,这对我来说还是不行的。我得到的是一个空格,而不是非ASCII字符。例如,
I have a Markdown text file, utf-8-encoded, that has some non-ASCII characters such as ’
. I couldn't get the reference Perl implementation to handle these characters correctly, but I can get it work with Pandoc. I'd like to be able to render my Markdown file straight from Emacs, using C-c C-c p
from Markdown mode, and that's still not working for me. I get what looks like a blank space instead of the non-ASCII character. For example,
I love apostrophe’s.
变成
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<p>I love apostrophe s.</p>
</body>
</html>
请注意,HTML包含 charset = utf-8
。这与我从命令行运行Pandoc几乎相同,除了丢失的撇号。我正在调用Pandoc,无论是从Emacs还是命令提示符,使用 pandoc -f markdown -t html -s --mathjax --highlight-style pygments
来自此处。
Note that the HTML contains charset=utf-8
. It's nearly identical to what I get running Pandoc from the command line, except for the missing apostrophe. I'm invoking Pandoc, whether from Emacs or the command prompt, using pandoc -f markdown -t html -s --mathjax --highlight-style pygments
, which I got from here.
我可以从Emacs中获得正确的撇号和其他unicode字符吗?
Can I get the apostrophe and other unicode characters to render properly from Emacs?
编辑:使用 Cu Cx = @ / code>命令@ db48x建议,我验证空白字符是一个常规空格(#x20)
using the C-u C-x =
command that @db48x suggested, I verified that the blank character is a regular space (#x20)
推荐答案
运行 Mx自定义变量
并切换 markdown-command-needs-filename
以解决我的问题。
Running M-x customize-variable
and toggling markdown-command-needs-filename
to on solved the problem for me.
这篇关于从Emacs在Markdown中渲染unicode字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!