From d5fb104a74ca0a823562b7d0216f9a5729bede8b Mon Sep 17 00:00:00 2001 From: Carlos A Becker Date: Mon, 7 Feb 2022 09:28:47 -0300 Subject: [PATCH] fix: do not replace comments with empty lines Signed-off-by: Carlos A Becker --- ansi/elements.go | 4 ++-- testdata/readme.markdown.in | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ansi/elements.go b/ansi/elements.go index cd253cf..5e8adb5 100644 --- a/ansi/elements.go +++ b/ansi/elements.go @@ -156,7 +156,7 @@ func (tr *ANSIRenderer) NewElement(node ast.Node, source []byte) Element { return Element{ Exiting: post, Renderer: &ItemElement{ - IsOrdered: node.Parent().(*ast.List).IsOrdered(), + IsOrdered: node.Parent().(*ast.List).IsOrdered(), Enumeration: e, }, } @@ -332,7 +332,7 @@ func (tr *ANSIRenderer) NewElement(node ast.Node, source []byte) Element { n := node.(*ast.HTMLBlock) return Element{ Renderer: &BaseElement{ - Token: ctx.SanitizeHTML(string(n.Text(source)), true) + "\n", + Token: ctx.SanitizeHTML(string(n.Text(source)), true), Style: ctx.options.Styles.HTMLBlock.StylePrimitive, }, } diff --git a/testdata/readme.markdown.in b/testdata/readme.markdown.in index 15f8974..65b6b89 100644 --- a/testdata/readme.markdown.in +++ b/testdata/readme.markdown.in @@ -23,6 +23,8 @@ Check out the [Gold Style Gallery](https://github.com/charmbracelet/gold/blob/ma Currently `gold` uses the [Aurora ANSI colors](https://godoc.org/github.com/logrusorgru/aurora#Index). + + ## Development Style definitions located in `styles/` can be embedded into the binary by @@ -32,5 +34,14 @@ running [statik](https://github.com/rakyll/statik): statik -f -src styles -include "*.json" ``` + + You can re-generate screenshots of all available styles by running `gallery.sh`. This requires `termshot` and `pngcrush` installed on your system!