Issue #939 new

literalinclude strip indent

Andy Harrington avatarAndy Harrington created an issue

If I just use a :: block, and copy in lines of code, the formatted code appears as far to the left as possible - the common indent is eliminated. This is handy in an html window with limited width. If I use literalinclude for the same lines, the common indent is left in. I would like an option, something like :shiftleft:, to make the behavior of literalinclude be the same as with copying the lines - leftmost not-blank character at the left margin.

Comments (1)

  1. Laurent Gautier

    I would also be interested in that feature.

    I am using literalinclude to fetch snippets from unit tests. This allows me to make sure that the code shown in the documentation is running, but that code is obviously nested in a method (and this leads to the indentation issue Andy Harrington is reporting).

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.