blackfriday icon indicating copy to clipboard operation
blackfriday copied to clipboard

Code blocks not parsed correctly

Open simonasGit opened this issue 2 years ago • 1 comments

The text:

- dir1
	- [title](url)
- dir2
	- something
- [hello](http://)
  #1tag1 #tag2
  ```markdown
  # some text
  'bout sumthin'
  [f](http://ecosia.org)
  ```
- [hello](url)
  #tag1 #tag2
- [hello](url)
  #tag1 #tag2

The code:

package main

import (
	"fmt"
	"os"
	"github.com/russross/blackfriday/v2"
)

var data, _ = os.ReadFile("the text above")

func main() {
	p := blackfriday.New(blackfriday.WithExtensions(blackfriday.FencedCode))
	rootList := p.Parse([]byte(data)).FirstChild                                                                   
	fmt.Printf("%s", rootList.FirstChild.Next.Next.Next)
}

Output: (*blackfriday.Node)(nil) For some reason the list is parsed with the first 3 items as children, and the other 2 as children of a list under the - [hello](http://) item. I assume something's wrong with the way code blocks are parsed in a list?

Edit: issue is caused when language is specified.

simonasGit avatar Sep 28 '23 14:09 simonasGit

I see the same issue. When specifying the block info it breaks parsing.

real-martin avatar Feb 06 '25 00:02 real-martin