Skip to content

Commit

Permalink
chore(parser): bug report
Browse files Browse the repository at this point in the history
if the first item on a line is a inline code element, the rest of the line is detected as a paragraph, but excluding the code element at the beginning:

```markdown
`fleck` is perfect
```

Should produce:

```html
<p><code>fleck</code> is perfect</p>
```

But it produces:

```html
<code>fleck</code>
<p>is perfect</p>
```

A possible fix could be to move the inline code parsing from the parser.Parser.code() function to the parser.Parser.paragraph() function, due to the fact, that inline code elements should only exists in paragraphs, not on their own
  • Loading branch information
xNaCly committed Apr 24, 2023
1 parent 2678d06 commit 22a5ab6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,11 @@ func (p *Parser) emphasis() Tag {
// parses code blocks and inline code elements
func (p *Parser) code(quoteContext bool) Tag {
// FIXED: inline code elements containing dashes (-) are not parsed correctly
// BUG: if the first item on a line is a inline code element, the rest of the line is detected as a paragraph, but excluding the code element at the beginning
// BUG: if no language or type is specified the parser assumes the next line to be the content
p.advance()
if p.check(scanner.BACKTICK) {
// codeblock:
// code block:
p.advance()
if !p.check(scanner.BACKTICK) {
return CodeInline{
Expand Down

0 comments on commit 22a5ab6

Please sign in to comment.