Markdown-preview does't work in emacs markdown mode - emacs

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/

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).

Related

Markdown preview in emacs fails: (pandoc?) error 127

I am trying to create a markdown document in Emacs *.
It does highlight the syntax etc. and goes into Markdown mode (I am not quite sure if I installed that package or if it is standard issue)..
Problem:
When I try to create a preview (either via C-c C-c p or the GUI), it returns this error code:
markdown failed with exit code 127
Question
What does this error tell me? Is there a way to get a more complete error message?
The docs for markdown-mode suggest that it calls on an external library such as pandoc, which I have installed. According to these SO questions, pandoc can return this error code, but I could not quite establish what it means.
How do I fix this / what documentation should I go to?
I am pretty new to Emacs, so anything will help. Thanks!
*Emacs version 25.3.1 on a Mac (Sierra 10.12.6)
The simplest fix is likely to install the markdown package using your package manager.
I fixed this error for myself with:
$ brew install markdown
(on MacOS Mojave, at the bash command line). Brew installed the "bottle" markdown-1.0.1.mojave.bottle.tar.gz, after which C-c C-c p or M-x markdown-preview worked to export the markdown file and open a browser window showing the exported file.
On an Ubuntu 19 (and now 20.04 and 21.10) system, sudo apt install markdown worked too.
You could do the same thing with a symlink to pandoc's markdown, but a) this just worked, b) there's no fiddling with a potentially messed up manually created symlink, and c) it's tiny (a 36 KByte executable). Pandoc's markdown may support more "modern" markdown, though.

export org that has latex formular to odt failed

I followed this doc: http://orgmode.org/manual/Working-with-LaTeX-math-snippets.html#fn-1
install perl-latexml on my ArchLinux, my emacs is 25.1.1 + spacemacs
My org has one latex formular, when config the following line in emacs, export to odt failed
(defun dotspacemacs/user-config ()
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
(require 'org)
(require 'org-chinese-utils)
(ocus-enable)
(setq org-latex-to-mathml-convert-command
"latexmlmath \"%i\" --presentationmathml=%o")
)
Formatting LaTeX using mathml OpenDocument export failed: Wrong type
argument: integer-or-marker-p,
How to fix this, I do not know what causes this problem?
If I remove the configuration in .spacemacs, export works, but no latex formular converted.
(setq org-latex-to-mathml-convert-command
"latexmlmath \"%i\" --presentationmathml=%o")
There was a bug in the odt dispatcher. In the function org-odt--translate-latex-fragments (see ox-odt.el) the function org-format-latex is called with the wrong arguments (or wrong order). I actually believe that this function was changed, and perhaps not all of the dispatchers were updated properly. Anyway, the bug was fixed in late 2016. Here is a link to the patch.
I am having exactly the same problem. My system is identical using Arch Linux, Emacs 25.1.1 and spacemacs. I also installed perl-latexml and configured emacs accordingly.
The error message is
OpenDocument export failed: Wrong type argument: integer-or-marker-p, "/path/to/folder/"
From my understanding the argument should be "/path/to/folder/file.org/" instead of "/path/to/folder/".
The error message is the same when I try to use dvipng or imagemagick to render the math snippets.
I also tried my older emacs config without spacemacs. The problem persists, so its independent of spacemacs.

Emacs and Skim not in Sync fails to open

New to posting to Stack Overflow, but I'll ask away. I have been having issues linking up Emacs with Skim. Using tex-mode.
I have used code that has been posted here on the site that shows how to do it.
Which does compile and shows output. Produces an .aux .log and .pdf file
But fails to preview using C-c C-v. It does not open up skim and outputs an error that says.
"No appropriate `.dvi' file could be found"
from my understanding this snippet of code should be linking up C-c C-v, which is same to tex-view.
(setq TeX-view-program-selection '((output-pdf "PDF Viewer")))
(setq TeX-view-program-list
'(("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b")))
I am curious where this issue may be coming from, current emacs version is 24.5.1
using Tex Live 2014
Found Solution to my Problem:
I found that regular tex-mode pre-installed by emacs was not complete, and that I need to download auctex, from the packages listed in el-get or melpa to get it to work properly.

Export to pdf/image with Syntax highlightning - emacs

I have a file open in Emacs which highlights the syntax and I want to share the file (with syntax highlighting) with another person who does not use Emacs.
Is it possible to export the file open in Emacs with syntax highlightning?
Any target format is ok: e.g. HTML, PDF, Image
You can use the command M-x htmlfontify-buffer to create an html file with syntax highlighting from any buffer.
It's included in standard Emacs, definitely in version 24, I'm not sure about 23.
You can use htmlize-buffer that comes with 'htmlize.el' (find it at http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el.cgi (dead link?) or install from MELPA or download from the htmlize Github project. This will create a HTML file with all the syntax highlighting of your current buffer.

nXhtml is not highlighting PHP code, gives errors on loading

I'm using the latest nXhtml checked out from the repo, and using GNU Emacs version 24.0.91.1. When I open a PHP file it shows as un-syntax-highlighted text, and I get a compile error:
Error: Wrong type argument: number-or-marker-p, nil
and a message in the log:
File mode specification error: (cl-assertion-failed (functionp byte-compiled-fun))
I'm avoiding my .emacs and .emacs.d by running emacs with this command:
emacs -Q --eval '(load "/path/to/nxhtml/autostart")' /path/to/nxhtml/tests/in/heredoc.php
Even if you don't have a fix, how can I go about debugging this issue?
There seem to be a fair amount of such wrong-type-argument errors lately with the development version of Emacs (24). This might represent an Emacs bug. Or it might represent an nXhtml bug.
I suggest starting by notifying Lennart, the nXhtml author, trying to give him a clear recipe, starting from emacs -Q.
If that doesn't help, consider filing an Emacs bug: M-x report-emacs-bug.
To try to debug it a bit yourself, be sure to load only source files (e.g. for nXhtml), i.e., *.el, not *.elc, starting preferably with emacs -Q (no init file). Do M-x set-variable debug-on-error t to see where the error is raised. Then perhaps use M-x debug-on-entry FUNCTION, where FUNCTION is the function where the error seems to have been raised. Then step through the Emacs debugger, hitting d to step and c to skip through a step.
But again, I suggest starting with Lennart.
Try the newest version of Emacs.
I had the same problem (on Windows 7):
Error: Wrong type argument: number-or-marker-p, nil
at line 1471 of nxhtml-loaddefs.el.
Nxhtml seems fine on Emacs 24.1.50.1 (23 April 2012).
http://alpha.gnu.org/gnu/emacs/windows/?C=M;O=D