Emacs markdown-mode error on preview: "bin / bash: markdown: command not found"
Asked Answered
G

6

46

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

Screenshot of emacs' markdown error message

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?

Guadalupe answered 9/1, 2013 at 8:28 Comment(6)
What is your path for the markdown.pl script? What happens when you call the markdown script from bash?Fonz
Thank you for your reply & excuse me, I'm still newbie rummaging in the guts of software. That script you ask about has .pl (Perl isn't) file extension. I just followed instructions included in the package itself and saw no other requirement than place the .el file in the emacs load-path and let my emacs init file know about autoloading. Then, I tried the automatic way by typing at emacs M-x package-install markdown mode just if it were a dependencies problem. How might I check for the markdown.pl script? Scripts installed by the latter way said don't include any .pl file.Guadalupe
OK, I think, I'm following you now. For further references I recommend this reading. So, by typing at cli $ which markdown or $ which markdown-mode I got: no markdown-mode in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/txe/.local/bin:/home/txe/bin). but, I'm still at the same point, so any clue is welcomed.Guadalupe
Ok, I got it. I think. As reference for others looking for this same. I should also install, in my case, the proper package $ sudo yum install python-markdown2or $ sudo yum install pandoc which offers to be like a swiss army knife when is about converting files from a markup format into another. Thanks anyway to everyone. This log post will be probably useful to anyone in the same point.Guadalupe
Ok after lot of testing, markdown is the best for me $ yum install python-markdown2 then $ ln -s /usr/bin/markdown2 /usr/local/bin/markdown (thanks again, RupertPupkin ✪ fedora-forums)Guadalupe
For Ubuntu users, this would be sudo apt-get install markdown.Intermezzo
M
53

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"))
Moldavia answered 2/11, 2013 at 9:38 Comment(4)
Just a reminder: In my case, after installing the pandoc using apt-get install , command for markdown is just ` " pandoc"`Kep
This worked for me, after I installed markdown with "brew install markdown". I think this can be marked as the answer.Thimbu
brew install pandoc on OS XYaron
Can confirm this works on Windows too. Got pandoc windows release from github, extracted it, and set the path in emacs. Thanks!Trodden
H
19

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.

Heady answered 25/10, 2013 at 12:13 Comment(1)
This is a nice easy way to get a copy of markdown, but the commands you referenced didn't work for me until I mapped the markdown parser to the markdown-command in my ~/.emacs like so: (custom-set-variables '(markdown-command "/usr/local/bin/markdown"))Burmeister
I
8

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.

Isthmus answered 17/7, 2013 at 14:40 Comment(0)
J
3
  • Add emacs package repository to init.el:
(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/"))
(package-initialize)
  • Refresh packages:

M-x package-refresh-contents

  • Install emacs major mode markdown-mode by evaluating:

M-x package-install RET markdown-mode RET

  • Install markdown processor for your operating system:
brew install pandoc
#OR
sudo apt-get install pandoc
  • Verify pandoc installation:
which pandoc
# returns /usr/local/bin/pandoc
  • Map the markdown parser in init.el:
(custom-set-variables
  '(markdown-command "/usr/local/bin/pandoc"))
Jorin answered 1/4, 2020 at 2:28 Comment(0)
M
1

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

Malleus answered 30/7, 2015 at 4:55 Comment(0)
A
0

I migrated to a new machine recently and it looks like in macOS Monterey (maybe before) it looks like brew changed where it is installed. I changed my markdown-command to "/opt/homebrew/bin/pandoc" based on Saurabh's answer

Adaurd answered 11/11, 2021 at 22:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.