asciidoctor / asciidoctor-pdf

:page_with_curl: Asciidoctor PDF: A native PDF converter for AsciiDoc based on Asciidoctor and Prawn, written entirely in Ruby.
https://docs.asciidoctor.org/pdf-converter/latest/
MIT License
1.15k stars 500 forks source link

Add option to wrap lines in verbatim blocks using a wrap indicator and hanging indent #1812

Open ericzolf opened 4 years ago

ericzolf commented 4 years ago

Listing blocks currently can be either wrapped or non-wrapped, non-wrapped doesn't always work (especially not in PDFs), and wrapped makes the code/listing not very readable resp. can lead to confusion, hence the idea to have a nicer/clearer way to wrap lines. Asciidoc was able to do it, AFAICJ asciidoctor can't do it, and that's what I'd like to have.

To give an example, I'd have something like:

----
## the required sizing depends on the current and constantly growing size of each software repository.
----

which would be rendered as follows:

image

(it would be even cooler if the wrapped lines could be right aligned, it would make it even clearer that they're only the continuation of the first line, but indentation and arrow at the end of the first line would already be good enough)

Originally posted by @ericzolf in https://github.com/asciidoctor/asciidoctor/issues/3820#issuecomment-722326542

mojavelinux commented 2 years ago

One way to indicate wrapping is by enabling line numbers. If I use the following source:

:source-highlighter: rouge

[%linenums,text]
----
## the required sizing depends on the current and constantly growing size of each software repository.
----

Then it will appear as follows:

linenum-wrap

The line number serves as another sort of wrap indicator.

I'll follow-up later with ideas for how you could add a wrap indicator using an extended converter.