russross / blackfriday

Blackfriday: a markdown processor for Go
Other
5.41k stars 596 forks source link

Code blocks not parsed correctly #715

Open simonasGit opened 10 months ago

simonasGit commented 10 months ago

The text:

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

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.**