From 0917dc876613fd71c9726a34bf0138b4f5121be9 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Mon, 18 Nov 2019 06:18:01 +1000 Subject: Update markdown parsing library to github.com/gomarkdown/markdown (#944) --- vendor/github.com/gomarkdown/markdown/parser/esc.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 vendor/github.com/gomarkdown/markdown/parser/esc.go (limited to 'vendor/github.com/gomarkdown/markdown/parser/esc.go') diff --git a/vendor/github.com/gomarkdown/markdown/parser/esc.go b/vendor/github.com/gomarkdown/markdown/parser/esc.go new file mode 100644 index 00000000..0a79aa35 --- /dev/null +++ b/vendor/github.com/gomarkdown/markdown/parser/esc.go @@ -0,0 +1,20 @@ +package parser + +// isEscape returns true if byte i is prefixed by an odd number of backslahses. +func isEscape(data []byte, i int) bool { + if i == 0 { + return false + } + if i == 1 { + return data[0] == '\\' + } + j := i - 1 + for ; j >= 0; j-- { + if data[j] != '\\' { + break + } + } + j++ + // odd number of backslahes means escape + return (i-j)%2 != 0 +} -- cgit v1.2.3