Emacs markdown-mode error on preview: “bin / bash: markdown: command not found”

痴心易碎 提交于 2020-01-30 14:32:14

问题


I am using emacs 24 on fedora 17. I installed markdown-mode, but whenever I try to export a file by typing C-c C-c m or C-c C-c p in emacs, I got this error:

/bin/bash: markdown: command not found

I read that this is probably an issue with the path variable, so I compared the env variable by typing $ env at the command line and Esc-! env RET in emacs. I found the path variable description is the same in both cases.

What is this error? How can I fix it and execute markdown previews from within emacs?


回答1:


Install any markdown generating tool as you like, for example pandoc.

Then add the following line to your .emacs file:

(custom-set-variables
 '(markdown-command "/usr/local/bin/pandoc"))



回答2:


This error occurs when you do not have a markdown parser installed. Installing one is simple with brew. From the command line:

brew install markdown

This should result in something like:

==> Downloading http://daringfireball.net/projects/downloads/Markdown_1.0.1.zip
######################################################################## 100.0%
  /usr/local/Cellar/markdown/1.0.1: 2 files, 40K, built in 2 seconds

Before running that command, I had the same error you did. After running that command, which installs a markdown parser on your system, the emacs commands C-c C-c m and C-c C-c p worked as expected by opening an HTML version of my markdown file in either another buffer or the browser, respectively.




回答3:


You just need to pick and install a markdown parser:

  • rdiscount (gem install rdiscount).
  • python2-markdown (yum install python-markdown2)
  • or some other.

Then, in emacs:

M-x customize-mode RET markdown-mode

Set 'Markdown Command' to the name of the executable you installed -- for example, rdiscount or /usr/bin/markdown2.




回答4:


You need to setting up the markdown-command, there is a thread about displaying it in github way, through pandoc.



来源:https://stackoverflow.com/questions/14231043/emacs-markdown-mode-error-on-preview-bin-bash-markdown-command-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!