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 }