-
Notifications
You must be signed in to change notification settings - Fork 499
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
Syntax code blocks lose indenting but keep colours in PDF #236
Comments
Aha! This is a tab issue. We convert spaces (to an internal PDF spacer character) but we do not current convert tabs. Therefore, the tabs get dropped. This is related to asciidoctor/asciidoctor#1170. We can implement this feature ahead of core since it is handled by different code anyway. But that proposes the design we indent to implement. |
A quickfix is to use spaces instead of tabs, but I do understand that it's necessary to support both. |
Using spaces does work, and that's pretty acceptable from my point of view. The confusing thing is when something renders the way you expect in HTML but not in the PDF. |
That's just life at the moment since these are two completely different worlds. We're doing our best to squash these differences so that you can think at the higher level of abstraction...and I believe we can achieve that for all but the rarest edge cases. We just have to keep throwing data at it so we can see the trouble spots light up. |
I'm going to leave this issue open so that we normalize tabs, one way or another. |
I decided to do this correctly by actually expanding tabs to spaces instead of simply replacing them. That means counting columns and expanding tabs to the number of spaces needed to fill the column in which the tab is used. Not only will the spaces be preserved, it will now be possible to use tabs to align output into columns (such as the output of a command or otherwise tab-separated data). Unfortunately, things are going to be a bit weird before Asciidoctor 1.5.3 if you're using the indent attribute. The indent attribute triggers a replacement of tabs to spaces, but not with the expand logic (see https://github.com/asciidoctor/asciidoctor/blob/v1.5.2/lib/asciidoctor/parser.rb#L2632). Therefore, you may get mixed and unexpected behavior. If you aren't using the indent attribute, you won't be affected. The good news is now I know how to solve asciidoctor/asciidoctor#1170 properly. |
…ize attribute - expand tabs to spaces using proper tab expansion logic - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
…ize attribute - expand tabs to spaces using proper tab expansion logic - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
…ize attribute - expand tabs to spaces using proper tab expansion logic - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
…ize attribute - expand tabs to spaces using proper tab expansion logic - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
…ize attribute - expand tabs to spaces using proper tab expansion logic - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
…ize attribute - expand tabs to spaces using proper tab expansion logic - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
…ize attribute - expand tabs to spaces using proper tab expansion logic - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
…ize attribute - expand tabs to spaces using proper tab expansion logic - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
…ize attribute - expand tabs to spaces using proper tab expansion logic - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
…ize attribute - expand tabs to spaces using proper tab expansion logic - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
- expand tabs to spaces using proper tab expansion logic - skip tab expansion if already performed by Asciidoctor core - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
- expand tabs to spaces using proper tab expansion logic - skip tab expansion if already performed by Asciidoctor core - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
- expand tabs to spaces using proper tab expansion logic - skip tab expansion if already performed by Asciidoctor core - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
- expand tabs to spaces using proper tab expansion logic - skip tab expansion if already performed by Asciidoctor core - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
- expand tabs to spaces using proper tab expansion logic - skip tab expansion if already performed by Asciidoctor core - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
- expand tabs to spaces using proper tab expansion logic - skip tab expansion if already performed by Asciidoctor core - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
- expand tabs to spaces using proper tab expansion logic - skip tab expansion if already performed by Asciidoctor core - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
- expand tabs to spaces using proper tab expansion logic - skip tab expansion if already performed by Asciidoctor core - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
- expand tabs to spaces using proper tab expansion logic - skip tab expansion if already performed by Asciidoctor core - use simpler logic if lines only have tab indentation - use zero-width space to guard start of line instead of no-break space - add a capabilities hash to tune behavior of converter - remove preserve feature of layout_prose - guard indentation after passing highlighting source - add helper method to guard indentation in formatted text fragments - add guard indentation logic to CodeRay Prawn encoder
resolves #236 expand tabs to spaces
Code that is rendered correctly in the HTML output is coloured correctly (indicating that Pygments styling is occurring), but the indenting is lost in the PDF:
The text was updated successfully, but these errors were encountered: