0

I'm generating a documentation with sphinx and i would like to include some xml examples that are stored in separate files. Is it possible to include an external xml file in such a way that the output doc uses the proper highlighting?

I tried .. include:: file.xml inside my rst. but the highlighting was broken and I could not fix it.

mzjn
  • 48,958
  • 13
  • 128
  • 248
Jannik
  • 1
  • 2
  • I think you want `literalinclude`: https://stackoverflow.com/q/8913336/407651, https://stackoverflow.com/q/18801693/407651 – mzjn Jun 23 '22 at 11:21

1 Answers1

1

Use the literalinclude directive.

.. literalinclude:: file.xml
    :language: xml
Steve Piercy
  • 13,693
  • 1
  • 44
  • 57