Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

literalinclude no content permitted #44

Open
fjp opened this issue Aug 6, 2019 · 1 comment
Open

literalinclude no content permitted #44

fjp opened this issue Aug 6, 2019 · 1 comment

Comments

@fjp
Copy link

fjp commented Aug 6, 2019

First of all thank you for this amazing converter, I really like it so far. However, when I try to include an external cpp file in one of my markdown with the following literalinclude directive:

.. literalinclude:: ../ch2-hello_world/exercises/exercise-01/main.cpp
   :language: cpp
   :caption: helloworldextended.cpp

The code is not rendered and I get the following warning in the raw build output:

../ch2-hello_world/exercises/exercise-01/README.md:12: WARNING: Error in "literalinclude" directive:
no content permitted.

.. literalinclude:: ../ch2-hello_world/exercises/exercise-01/main.cpp

:language: cpp
:caption: helloworldextended.cpp

However, if I add text or just a single character after the above literalinclude everything works as expected. The code from the cpp file renders fine.

.. literalinclude:: ../ch2-hello_world/exercises/exercise-01/main.cpp
   :language: cpp
   :caption: helloworldextended.cpp


here is some text

Am I missing an option at the end of the literalinclude or why is text after it required to render the code properly?

Here is the result on read the docs running Sphinx v1.8.5, python 3.7 and m2r v0.2.1

@fjp fjp changed the title literalinclude literalinclude does not render Aug 6, 2019
@fjp fjp changed the title literalinclude does not render literalinclude no content permitted Aug 6, 2019
@Barmaley13
Copy link

Barmaley13 commented Nov 8, 2019

Noticed the same problem.

Found work around for now

.. literalinclude:: ../ch2-hello_world/exercises/exercise-01/main.cpp
   :language: cpp
   :caption: helloworldextended.cpp

.. here is some text

I think the problem is that m2r adds new line after initial directive. But that only happens if there is nothing else following after this directive

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

No branches or pull requests

2 participants