From 17877ca5858f1f64bc059b0d779618dc42d35657 Mon Sep 17 00:00:00 2001 From: bouncepaw Date: Sat, 21 Nov 2020 13:52:20 +0500 Subject: [PATCH] Do not ignore empty lines in preformatted blocks --- markup/lexer.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/markup/lexer.go b/markup/lexer.go index cfa6f96..a98848c 100644 --- a/markup/lexer.go +++ b/markup/lexer.go @@ -45,13 +45,17 @@ func geminiLineToAST(line string, state *GemLexerState, ast *[]Line) { *ast = append(*ast, Line{id: state.id, contents: text}) } + // Process empty lines depending on the current state if "" == strings.TrimSpace(line) { - if state.where == "list" { + switch state.where { + case "list": state.where = "" addLine(state.buf + "") - } else if state.where == "number" { + case "number": state.where = "" addLine(state.buf + "") + case "pre": + state.buf += "\n" } return }