Skip to content

Commit

Permalink
Add support for inline code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
tdemin committed Nov 11, 2020
1 parent 32ec381 commit 326dc63
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/gemini/renderer.go
Expand Up @@ -175,6 +175,9 @@ func (r Renderer) paragraph(w io.Writer, node *ast.Paragraph, entering bool) (no
if text, ok := child.(*ast.Text); ok {
r.text(w, text)
}
if inlineBlock, ok := child.(*ast.Code); ok {
r.text(w, inlineBlock)
}
}
if !onlyElementIsLink {
w.Write(lineBreak)
Expand Down Expand Up @@ -244,8 +247,10 @@ func (r Renderer) list(w io.Writer, node *ast.List, level int) {
}
}

func (r Renderer) text(w io.Writer, node *ast.Text) {
w.Write(node.Literal)
func (r Renderer) text(w io.Writer, node ast.Node) {
if node := node.AsLeaf(); node != nil {
w.Write(node.Literal)
}
}

// RenderNode implements Renderer.RenderNode().
Expand Down

0 comments on commit 326dc63

Please sign in to comment.