Add option to disable AutoLink parsing
This commit is contained in:
parent
592be07cfd
commit
3c2e9ed204
2 changed files with 3 additions and 1 deletions
|
@ -13,6 +13,7 @@ type Document struct {
|
||||||
Footnotes *Footnotes
|
Footnotes *Footnotes
|
||||||
StatusKeywords []string
|
StatusKeywords []string
|
||||||
MaxEmphasisNewLines int
|
MaxEmphasisNewLines int
|
||||||
|
AutoLink bool
|
||||||
BufferSettings map[string]string
|
BufferSettings map[string]string
|
||||||
DefaultSettings map[string]string
|
DefaultSettings map[string]string
|
||||||
}
|
}
|
||||||
|
@ -57,6 +58,7 @@ func NewDocument() *Document {
|
||||||
Title: "Footnotes",
|
Title: "Footnotes",
|
||||||
Definitions: map[string]*FootnoteDefinition{},
|
Definitions: map[string]*FootnoteDefinition{},
|
||||||
},
|
},
|
||||||
|
AutoLink: true,
|
||||||
MaxEmphasisNewLines: 1,
|
MaxEmphasisNewLines: 1,
|
||||||
BufferSettings: map[string]string{},
|
BufferSettings: map[string]string{},
|
||||||
DefaultSettings: map[string]string{
|
DefaultSettings: map[string]string{
|
||||||
|
|
|
@ -126,7 +126,7 @@ func (d *Document) parseFootnoteReference(input string, start int) (int, Node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Document) parseAutoLink(input string, start int) (int, int, Node) {
|
func (d *Document) parseAutoLink(input string, start int) (int, int, Node) {
|
||||||
if len(input[start:]) < 3 || input[start+1] != '/' || input[start+2] != '/' {
|
if !d.AutoLink || len(input[start:]) < 3 || input[start+1] != '/' || input[start+2] != '/' {
|
||||||
return 0, 0, nil
|
return 0, 0, nil
|
||||||
}
|
}
|
||||||
protocolStart, protocol := start-1, ""
|
protocolStart, protocol := start-1, ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue