jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.61k stars 3.38k forks source link

Mardown with image with alt doesn't seem to be convert properly into rST #2179

Closed s-celles closed 9 years ago

s-celles commented 9 years ago

Hello,

I have a Mardown file with image with alt.

It looks like:

### Matplotlib plot of a confusion matrix

    confusion_matrix.plot()
    plt.show()

![confusion_matrix](screenshots/cm.png)

### Matplotlib plot of a normalized confusion matrix

But this file is converted into:

Matplotlib plot of a binary confusion matrix
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

::

    binary_confusion_matrix.plot()
    plt.show()

.. figure:: screenshots/binary_cm.png
   :alt: binary\_confusion\_matrix

   binary\_confusion\_matrix
Matplotlib plot of a normalized binary confusion matrix
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It raise a parse error into Pypi see https://github.com/msabramo/setuptools-markdown/issues/5

I think that problem is because of "binary_confusion_matrix" before title "Matplotlib plot of a normalized binary confusion matrix".

This line (with only "binary_confusion_matrix") shouldn't appears in converted rST file.

I don't know if this is because of "pandoc" or "pypandoc".

Any idea to fix it ?

Kind regards

jgm commented 9 years ago

I don't think there's a bug here. You may be using an older version of pandoc with some spacing issues. With current dev version, I get a blank line after the caption.

.. figure:: screenshots/cm.png
   :alt: confusion\_matrix

   confusion\_matrix

Matplotlib plot of a normalized confusion matrix
================================================

The confusion\_matrix is the figure's caption. See the documentation for the implicit_figures extension in the pandoc user's guide.

s-celles commented 9 years ago
$ pandoc -v
pandoc 1.12.4.2
Compiled with texmath 0.6.6.3, highlighting-kate 0.5.11.1.
Syntax highlighting is supported for the following languages:
    abc, actionscript, ada, agda, apache, asn1, asp, awk, bash, bibtex, boo, c,
    changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css,
    curry, d, diff, djangotemplate, dockerfile, dot, doxygen, doxygenlua, dtd,
    eiffel, email, erlang, fasm, fortran, fsharp, gcc, glsl, gnuassembler, go,
    haskell, haxe, html, ini, isocpp, java, javadoc, javascript, json, jsp,
    julia, latex, lex, lilypond, literatecurry, literatehaskell, lua, m4,
    makefile, mandoc, markdown, mathematica, matlab, maxima, mediawiki,
    metafont, mips, modelines, modula2, modula3, monobasic, nasm, noweb,
    objectivec, objectivecpp, ocaml, octave, opencl, pascal, perl, php, pike,
    postscript, prolog, pure, python, r, relaxng, relaxngcompact, rest, rhtml,
    roff, ruby, rust, scala, scheme, sci, sed, sgml, sql, sqlmysql,
    sqlpostgresql, tcl, tcsh, texinfo, verilog, vhdl, xml, xorg, xslt, xul,
    yacc, yaml, zsh
Default user data directory: /Users/scls/.pandoc
Copyright (C) 2006-2014 John MacFarlane
Web:  http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.
s-celles commented 9 years ago

I don't understand what is going on... because I installed pandoc-1.13.2-osx.pkg but I'm always getting

$ pandoc -v
pandoc 1.12.4.2
jgm commented 9 years ago

You probably have an old version in your path that takes priority over the new version. Do which pandoc and it will tell you where this old version is. You can try adding /usr/local/bin to the beginning of your path so it takes precedence.

+++ scls19fr [May 27 15 01:43 ]:

I don't understand what is going on... because I installed pandoc-1.13.2-osx.pkg but I'm always getting

$ pandoc -v pandoc 1.12.4.2


Reply to this email directly or view it on GitHub: https://github.com/jgm/pandoc/issues/2179#issuecomment-105825971

s-celles commented 9 years ago
$ which pandoc
/usr/local/bin/pandoc

I removed manually this file using

$ sudo rm /usr/local/bin/pandoc

and run again Mac OS X package pandoc-1.13.2-osx.pkg ... it's working fine now.

$ pandoc -v
pandoc 1.13.2

then I convert README.md (long description of Python package) to rst using setuptools-markdown

python setup.py --long-description > README.rst

then I did

restview --pypi-strict README.rst

and error is fixed.

Thanks.

mgedmin commented 9 years ago

FWIW the latest released pandoc version is 1.0.0a8 and it suffers from this bug.

Any plans for a newer release?

mgedmin commented 9 years ago

Uhh, maybe I'm confused and that's not the real pandoc.

mgedmin commented 9 years ago

(Apologies, I got used to pip installing packages to get latest upstream versions.)