Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add include, substitution and admonition support reST markup #223

Closed
jgm opened this issue Jun 10, 2011 · 22 comments
Closed

Add include, substitution and admonition support reST markup #223

jgm opened this issue Jun 10, 2011 · 22 comments

Comments

@jgm
Copy link
Owner

jgm commented Jun 10, 2011

Hi!

It would be nice if Pandoc would have support for full reST markup which is
more powerful than e.g. markdown, and with the present suite of 'writers'
it would allow converting input to many output formats.



Sincerely,
Gour




Google Code Info:
Issue #: 130
Author: [email protected]
Created On: 2009-02-21T09:48:14.000Z
Closed On: 
@ghost ghost assigned jgm Jun 10, 2011
@jgm
Copy link
Owner Author

jgm commented Jun 10, 2011

The features that I've particularly missed: "include" and "admonition".

I still have to use rst2html.py for my documents that use these features.

#t

Google Code Info:
Author: [email protected]
Created On: 2009-04-17T15:38:42.000Z

@jgm
Copy link
Owner Author

jgm commented Jun 10, 2011

I'm particularly missing the "class" directive, especially in conjunction with code
blocks. According to the ReST docs, you use it like this:

.. class:: special

This is a special paragraph.

For code blocks, you need to do this:

.. class:: python
..

::

def some_python_function():
# etc

Google Code Info:
Author: [email protected]
Created On: 2009-11-09T11:38:14.000Z

@jgm
Copy link
Owner Author

jgm commented Jun 10, 2011

An alternative for nicer handling of code blocks would be the custom 'code-block'
directive that is commonly used. It is implemented by Sphinx, a popular tool for
documenting libraries, especially Python. See http://sphinx.pocoo.org/markup/
code.html. Syntax is much simpler than the above:

.. code-block:: python

def some_python_function():
# etc

Google Code Info:
Author: [email protected]
Created On: 2009-11-09T11:59:52.000Z

@valholl
Copy link

valholl commented Jul 16, 2012

I would love full support for reStructuredText too.

One thing I'm missing is support for substitution definitions: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#substitution-definitions with image and replace directives.

@EronHennessey
Copy link

Agreed with the above comments, and would like to refresh this issue.

I'd dearly love to see reStructuredText's .. include:: filename.rst directives honored (or at least some output that they've been ignored). This, to me, is one of the largest benefits of using reST instead of markdown.

I'm currently getting around this by using rst2html.py to convert the files to HTML, then using pandoc to convert it from HTML to markdown (for GitHub, etc.)... it's weird to have to use HTML as the intermediary format, but it works. ;)

Substitution support would be great, too.

@ramnathv
Copy link

Let me add another vote for this 👍

@mpickering mpickering changed the title full support for reST markup Add include, substitution and admonition support reST markup Dec 7, 2014
@mpickering
Copy link
Collaborator

To summarise, missing features are

  • include
  • substitution
  • admonition

The latter two should be easy to implement. The first requires some more machinery I am currently thinking about.

@chiffa
Copy link

chiffa commented Feb 23, 2016

I would suggest that ..include:: is a critical part of the ReStructuredText and the reason I am working with it.

@timofurrer
Copy link

What's the state on the `.. include::`` directive?

@jgm
Copy link
Owner Author

jgm commented Nov 16, 2016

.. include:: is not yet implemented.

Currently this would require adding a handleIncludes function like in the LaTeX reader, and modifying pandoc.hs to run this on the input before passing it to the (pure) LaTeX reader. This is pretty ugly, though. A cleaner solution would require #2930, which would allow pure readers to be run with IO (processing includes) or without it.

jgm added a commit that referenced this issue Dec 4, 2016
TODO: handle the options (see comment in code).
See #223.
@jgm
Copy link
Owner Author

jgm commented Dec 4, 2016

include is now implemented in the typeclass branch, which will eventually become pandoc 2.0.

It shouldn't be too hard to implement admonition and substitution as well.

jgm added a commit that referenced this issue Dec 8, 2016
TODO: handle the options (see comment in code).
See #223.
jgm added a commit that referenced this issue Dec 24, 2016
TODO: handle the options (see comment in code).
See #223.
jgm added a commit that referenced this issue Jan 16, 2017
TODO: handle the options (see comment in code).
See #223.
jgm added a commit that referenced this issue Jan 24, 2017
TODO: handle the options (see comment in code).
See #223.
@jgm jgm modified the milestone: pandoc 2.0 Jan 25, 2017
jgm added a commit that referenced this issue Jan 25, 2017
TODO: handle the options (see comment in code).
See #223.
@jgm
Copy link
Owner Author

jgm commented Feb 7, 2017

We've got admonitions now.

jgm added a commit that referenced this issue Feb 7, 2017
* We no longer add an "admonition" class, we just use the
  class for the type of admonition, "note" for example.
* We put the word corresponding to the label in a paragraph
  inside a div at the beginning of the admonition with class
  "admonition-title".
* This is about as close as we can get to RST's own output.

See #223.
@jgm
Copy link
Owner Author

jgm commented Feb 7, 2017

And we've had substitutions for a long time. I think this issue can now finally be closed!

@jgm jgm closed this as completed Feb 7, 2017
jgm added a commit that referenced this issue Feb 27, 2017
DZSlides: Force word wrapping in code tags
@mcepl
Copy link

mcepl commented Jul 19, 2017

include is now implemented in the typeclass branch, which will eventually become pandoc 2.0.

There is no typeclass branch in the current repo. Where can I find .. include:: honoring code for testing?

@mb21
Copy link
Collaborator

mb21 commented Jul 19, 2017

I think the typeclass branch has been merged into current master already...

@mcepl
Copy link

mcepl commented Jul 19, 2017

And does the release 1.19.2.1 contain it as well or do I have to build from the git checkout?

@iandol
Copy link
Contributor

iandol commented Jul 20, 2017

You can try the nightly build: https://github.com/pandoc-extras/pandoc-nightly/releases

@Gim6626
Copy link

Gim6626 commented May 30, 2018

Got pandoc v1.19.2.4, no "include" support. Since which version it was added?

@mb21
Copy link
Collaborator

mb21 commented May 30, 2018

Just get the newest pandoc from https://github.com/jgm/pandoc/releases

@saurabhnanda
Copy link

Two question regarding the include directive:

  • Is is possible to include a function that resolves relative paths, else the directlve becomes brittle when (a) you're processing multiple RST documents from a deeply nested directory tree, or (b) moving files around.
  • is it possible to use the include directive to include external code snippets such that pandoc recognizes them as code snippets and parses / renders them accordingly?

@jgm
Copy link
Owner Author

jgm commented Aug 21, 2020

is it possible to use the include directive to include external code snippets such that pandoc recognizes them as code snippets and parses / renders them accordingly?

Can you do this in RST? If so, try the same syntax with pandoc and see if it works. IF not, we should support it, but open a new issue.

Is is possible to include a function that resolves relative paths,

I'm not sure what you mean here; relative paths should work, but pandoc interprets them relative to the working directory (or any --resource-paths).

@saurabhnanda
Copy link

@jgm continuing the conversation in two separate threads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests