Open tajmone opened 4 years ago
RIght now, the only workaround solution is to add a word joiner character (⁠
) at the beginning of the first indented line using its predefined attribute for character replacement ({wj}
):
[source,hugo, subs="+attributes"]
---------------------------------
{wj} counter = -1
---------------------------------
This works fine, although it's far from being an ideal solution (but, at least, it shouldn't create any problems for other Asciidoctor backends and output formats).
I've looked into the issue and studied both the Haml template, the Highlight extensions and the SCSS stylesheet.
Form what I've gathered, the problem is that during the highlighting process the leading whitespace of the first code line is lost somewhere in the various passages between Asciidoctor, Haml and the Highlight extension.
The leading whitespace is not included in the HTML output (whereas without Highlight it is), so it's not a CSS issue.
I wasn't able to pin down the exact nature of the problem, but I'm afraid there's no immediate nor easy solution to this.
The problem was finally fixed by editing the Haml template and using the :preserve
filter.
For more info on the solution and its implementation, see the Alan-Docs project:
After a Hugo code block starting with an indentation is processed by Highlight, the indentation on the first line is lost.
{wj}
workaround (see below).{wj}
previously added for the temporary workaround.Since this happens only in the first line of code, it could be either:
For an example, see: