Skip to content

Commit

Permalink
Haml Listing Template v1.1.0
Browse files Browse the repository at this point in the history
Fix `block_listing.html.haml`, the Haml HTML listing template used for
integrating Highlight into the Asciidoctor toolchain.

The original template was chewing up indentation of the first line in
code blocks that began with an indented line. This commit fixes the
problem by using the `:preserve` filter to ensure that indentation is
never affected. (Fixes #70)
  • Loading branch information
tajmone committed Oct 12, 2020
1 parent 58ecc16 commit aa8fb65
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions _assets/hl/haml/block_listing.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
-# "block_listing.html.haml" v1.0.0 | 2019/03/01 | by Tristano Ajmone
-# "block_listing.html.haml" v1.1.0 | 2020/10/11 | by Tristano Ajmone
-# =============================================================================
-# Custom Haml template for Highlight syntax highlighter
-# Custom Haml template for Highlight syntax highlighter
-# =============================================================================
-# Template tweaked to preserve first-line indentation via `:preserve` filter.
-# The original was chewing up the indentation of the first line.
-#
-# Adds 'lang=<language>' to <pre> tag to allow using different CSS themes with
-# each language. Example:
-#
Expand Down Expand Up @@ -40,6 +43,8 @@
- nowrap = false
- pre_class << 'nowrap' if nowrap
%pre{:class=>pre_class, :lang=>pre_lang}
%code{:class=>code_class, 'data-lang'=>code_lang}=content
%code{:class=>code_class, 'data-lang'=>code_lang}
:preserve
#{content}
- else
%pre{:class=>('nowrap' if nowrap)}=content

0 comments on commit aa8fb65

Please sign in to comment.