Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions parser/inline.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func maybeInlineFootnoteOrSuper(p *Parser, data []byte, offset int) (int, ast.No
// '[': parse a link or an image or a footnote or a citation
func link(p *Parser, data []byte, offset int) (int, ast.Node) {
// no links allowed inside regular links, footnote, and deferred footnotes
if p.insideLink && (offset > 0 && data[offset-1] == '[' || len(data)-1 > offset && data[offset+1] == '^') {
if p.InsideLink && (offset > 0 && data[offset-1] == '[' || len(data)-1 > offset && data[offset+1] == '^') {
return 0, nil
}

Expand Down Expand Up @@ -622,10 +622,10 @@ func link(p *Parser, data []byte, offset int) (int, ast.Node) {
} else {
// links cannot contain other links, so turn off link parsing
// temporarily and recurse
insideLink := p.insideLink
p.insideLink = true
InsideLink := p.InsideLink
p.InsideLink = true
p.Inline(link, data[1:txtE])
p.insideLink = insideLink
p.InsideLink = InsideLink
}
return i, link

Expand Down Expand Up @@ -860,7 +860,7 @@ const shortestPrefix = 6 // len("ftp://"), the shortest of the above

func maybeAutoLink(p *Parser, data []byte, offset int) (int, ast.Node) {
// quick check to rule out most false hits
if p.insideLink || len(data) < offset+shortestPrefix {
if p.InsideLink || len(data) < offset+shortestPrefix {
return 0, nil
}
for _, prefix := range protocolPrefixes {
Expand Down
4 changes: 2 additions & 2 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ type Parser struct {
inlineCallback [256]InlineParser
nesting int
maxNesting int
insideLink bool
InsideLink bool
indexCnt int // incremented after every index

// Footnotes need to be ordered as well as available to quickly check for
Expand Down Expand Up @@ -143,7 +143,7 @@ func NewWithExtensions(extension Extensions) *Parser {
refs: make(map[string]*reference),
refsRecord: make(map[string]struct{}),
maxNesting: 64,
insideLink: false,
InsideLink: false,
Doc: &ast.Document{},
extensions: extension,
allClosed: true,
Expand Down