Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Markdown-preview does't work in emacs markdown mode

Tags:

emacs

markdown

Markdown preview command doesn't work.

I installed markdown-mode.el on emacs by using package-install. Then I created test.md file as a trial. Syntax hi-lighting apparently works fine in the text.

When I used "C-c C-c p" command in order to show markdown preview, I got following error message in backtrace buffer. Even if I saved test.md file in current directory, it still said "No such file or directory". The file is located in "~/workspace/daily_log/test.md."

I tried "M-x markdown-preview" instead of shortcut key. But it doesn't work,too.

Do I make a mistake about usage of markdown-mode? Any help would be appreciated. Thanks in advance.

Error message in backtrace buffer

Debugger entered--Lisp error: (file-error "Searching for program" "No such file or directory" "bash.exe")
call-process-region(1 36 "bash.exe" "/tmp/emacsAxnXZ9" #<buffer *markdown-output*> nil "-c" "markdown")
shell-command-on-region(1 36 "markdown" "*markdown-output*")
markdown("*markdown-output*")
markdown-preview()
call-interactively(markdown-preview nil nil)
command-execute(markdown-preview)

my environment

OS: Ubuntu 14.10

emacs: 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2)

markdown-mode: markdown-mode-20140914.1012/

like image 941
yufit_in_Japan Avatar asked Nov 16 '14 12:11

yufit_in_Japan


People also ask

How do I Preview markdown in Emacs?

Start impatient mode in the buffers you're interested to live preview: M-x impatient-mode . Open your browser to localhost:8080/imp. You'll see the list of buffers with the mode enabled. Click on one: you see live rendering of the buffer.

How do I install Markdown preview?

Install from atom (Recommended)Open atom editor, open Settings , click Install , then search markdown-preview-enhanced . After installation, you must restart atom to take effects. It is recommended to disable the builtin markdown-preview package after you install this package.

What is markdown mode?

'markdown-mode' is a major mode for GNU Emacs which provides syntax highlighting and supporting commands for editing Markdown files. It provides keybindings and commands for inserting Markdown elements and to assist in calling 'markdown' to parse the source code or preview the document in a browser.


1 Answers

If you inspect the backtrace you'll see that this has nothing to do with your Markdown file.

markdown-preview needs an external markdown command that can generate HTML. It looks like whatever Markdown processor you are using is trying to call bash.exe (not bash) when converting your file.

  • You might have installed some Windows-centric Markdown converter.
  • You might have customized markdown-command, directly or indirectly causing it to call bash.exe.

Since you are on Ubuntu, a simple apt-get install markdown should give you a decent Markdown that works with markdown-mode's markdown-preview function. After installing markdown at the system level, make sure that Emacs has markdown-command set to markdown (the default value).

like image 146
Chris Avatar answered Sep 28 '22 08:09

Chris