russross / blackfriday

Blackfriday: a markdown processor for Go
Other
5.45k stars 602 forks source link

Code blocks not parsed correctly #715

Open simonasGit opened 1 year ago

simonasGit commented 1 year 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.**