package parserimport ()// returns aisde prefix lengthfunc ( *Parser) ( []byte) int { := 0 := len()for < 3 && < && [] == ' ' { ++ }if +1 < && [] == 'A' && [+1] == '>' {if +2 < && [+2] == ' ' {return + 3 }return + 2 }return0}// aside ends with at least one blank line// followed by something without a aside prefixfunc ( *Parser) ( []byte, , int) bool {ifIsEmpty([:]) <= 0 {returnfalse }if >= len() {returntrue }return .asidePrefix([:]) == 0 && IsEmpty([:]) == 0}// parse a aside fragmentfunc ( *Parser) ( []byte) int {varbytes.Buffer , := 0, 0// identical to quotefor < len() { = // Step over whole lines, collecting them. While doing that, check for // fenced code and if one's found, incorporate it altogether, // irregardless of any contents inside itfor < len() && [] != '\n' {if .extensions&FencedCode != 0 {if := .fencedCodeBlock([:], false); > 0 {// -1 to compensate for the extra end++ after the loop: += - 1break } } ++ } = skipCharN(, , '\n', 1)if := .asidePrefix([:]); > 0 {// skip the prefix += } elseif .terminateAside(, , ) {break }// this line is part of the aside .Write([:]) = } := .AddBlock(&ast.Aside{}) .Block(.Bytes()) .Finalize()return}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.