English 中文(简体)
如何转换带有图像的重组文本文件到标记?
原标题:How to convert reStructuredText files with images to markdown?

我有 rst 文件, 包含线条类似

.. figure:: examples/foo.png 
    :scale: 80%

    Fig. 1 : Illustration of the awesomeness of stackoverflow

现在我要将此文件转换为标记。 我尝试使用 pandoc ,

pandoc -s -w rst --toc foo.rst -o foo.md

但输出文件 foo. md 似乎忽略了数字包含行。 因此, 我如何才能在不失去数字的惊人性的情况下转换成标记文件? 谢谢

最佳回答

http://johnmacfarlane.net/pandoc/try "rel="nofollow" >This 在线演示Pandoc转换以下标记:

![Map to buried treasure](/path/to/img.jpg "Optional title")

转换成以下结构化文字:

.. figure:: /path/to/img.jpg
   :align: center
   :alt: Optional title

   Map to buried treasure

因此,这应该是如何定义一个可以转换为标记的数字。 但是, 在在线转换器中使用此重新构造的文本会导致错误, 错误信息非常无益。 您在运行 Pandoc 时是否收到错误信息?

您的重新结构化文本语法语法不正确: 数字( 和任何其他) 指令的选项应该缩进指令名称 。 尝试使用

.. figure:: examples/foo.png 
   :scale: 80%

   Fig. 1 : Illustration of the awesomeness of stackoverflow

看看这是否有所区别。

问题回答

暂无回答




相关问题
Sphinx, reStructuredText show/hide code snippets

I ve been documenting a software package using Sphinx and reStructuredText. Within my documents, there are some long code snippets. I want to be able to have them hidden as default, with a little "...

ReStructuredText numbered headers

Is there a way in rst to have automatic header numbering ? That is something like: #. Some Section =============== ... #. Some Subsection ------------------ ... #. Another Subsection -----------------...

What is a simple webpage compiler for restructured text?

Instead of a blog/cms, I d like to have a static html-based site with a few (rarely updated) pages. I figure the simplest way to update them is to keep the sources in a format like ReST, and compile ...

What markup language to store in a DB?

Related: How to store lightweight formatting (Textile, Markdown) in database? I want to store comment formatting in some markup language in our DB. However, we want to allow multiple formatting ...

External documentation for PHP, no DocBook

I need a documentation system for a PHP project and I wanted it to be able to integrate external documentation (use cases, project scope etc.) with the documentation generated from code comments. It ...

热门标签