From ac108c8c4a417c72351613a2efaa86490bdcdba8 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 18 Jul 2024 17:03:58 -0300 Subject: [PATCH] fix: build Signed-off-by: Carlos Alexandro Becker --- ansi/elements.go | 7 +++++-- examples/helloworld/main.go | 15 +++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ansi/elements.go b/ansi/elements.go index 2f6670ca..161857ab 100644 --- a/ansi/elements.go +++ b/ansi/elements.go @@ -67,8 +67,11 @@ func (tr *ANSIRenderer) NewElement(node ast.Node, source []byte) Element { // Paragraph case ast.KindParagraph: - if node.Parent() != nil && node.Parent().Kind() == ast.KindListItem { - return Element{} + if node.Parent() != nil { + kind := node.Parent().Kind() + if kind == ast.KindListItem { + return Element{} + } } return Element{ Renderer: &ParagraphElement{ diff --git a/examples/helloworld/main.go b/examples/helloworld/main.go index d7f28cdb..53282da3 100644 --- a/examples/helloworld/main.go +++ b/examples/helloworld/main.go @@ -3,15 +3,18 @@ package main import ( "fmt" - _ "embed" - "github.com/charmbracelet/glamour" ) -//go:embed input.md -var input []byte - func main() { - out, _ := glamour.Render(string(input), "dark") + in := `# Hello World + +This is a simple example of Markdown rendering with Glamour! +Check out the [other examples](https://github.com/charmbracelet/glamour/tree/master/examples) too. + +Bye! +` + + out, _ := glamour.Render(in, "dark") fmt.Print(out) }