blackfriday icon indicating copy to clipboard operation
blackfriday copied to clipboard

v2: Access to raw line in `RenderNode` ?

Open depado opened this issue 5 years ago • 1 comments

Hey. I'm back on my quest to add some capabilities to Blackfriday. Currently I'd love create a renderer that would extend the base renderer (or another custom renderer) to add the admonition extension. For now, I have something that works quite well for a single paragraph thing. This was kind of tricky to do and the code is quite... Let's just say "not clean". The only issue I have now, is that I can't seem to access the raw markdown line, because I'd like to know if there are still tabs or whitespaces at the start of the line between different paragraphs, just to know if we're still in an admonition block. Is there any way to do that?

For now, this is what I achieved:

image

With the following markdown:

# Admonition

!!! info "Info Example"
    So this is an example `info` admonition. For now, this renderer extension
    only supports *single-paragraph* style markdown. But as you can see, in the
    paragraph itself **the markdown is still parsed properly by the extended renderer**.
    My question is: Is there a way to get the raw line (including whitespace 
    prefixes) so I know whether or not we're still in an admonition block? 


\```go
package main

import "fmt"

// Just checking that the code highlighter still works.
func main() {
    fmt.Println("Hello World")
}
\```

!!! danger "Danger Example"
    This is a really dangerous thing to do. Please don't.

(Added a backslash in front of the triple backticks for formatting reasons)

depado avatar Jun 11 '19 13:06 depado

(By the way, the code is here)

depado avatar Jun 11 '19 13:06 depado