From 3c2e9ed2040cdf35d4059afb6cc0de8cdbc35047 Mon Sep 17 00:00:00 2001 From: Niklas Fasching Date: Sun, 2 Dec 2018 23:53:31 +0100 Subject: [PATCH] Add option to disable AutoLink parsing --- org/document.go | 2 ++ org/inline.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/org/document.go b/org/document.go index d061712..c4443ba 100644 --- a/org/document.go +++ b/org/document.go @@ -13,6 +13,7 @@ type Document struct { Footnotes *Footnotes StatusKeywords []string MaxEmphasisNewLines int + AutoLink bool BufferSettings map[string]string DefaultSettings map[string]string } @@ -57,6 +58,7 @@ func NewDocument() *Document { Title: "Footnotes", Definitions: map[string]*FootnoteDefinition{}, }, + AutoLink: true, MaxEmphasisNewLines: 1, BufferSettings: map[string]string{}, DefaultSettings: map[string]string{ diff --git a/org/inline.go b/org/inline.go index 5cb65a9..1248c44 100644 --- a/org/inline.go +++ b/org/inline.go @@ -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) { - 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 } protocolStart, protocol := start-1, ""