From fefa9e6745c0a8f761d20d3f2bde8f50986a0964 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 13 Jun 2021 11:54:43 -0700 Subject: [PATCH] Add modules, allow code blocks with spaces Fixes #3 --- go.mod | 5 +++++ go.sum | 2 ++ vimdoc.go | 11 +++-------- 3 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 go.mod create mode 100644 go.sum diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..5549a43 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/FooSoft/md2vim + +go 1.16 + +require github.com/russross/blackfriday v1.6.0 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..270cecf --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= +github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= diff --git a/vimdoc.go b/vimdoc.go index 895552f..7fe4860 100644 --- a/vimdoc.go +++ b/vimdoc.go @@ -318,14 +318,9 @@ func (*vimDoc) AutoLink(out *bytes.Buffer, link []byte, kind int) { } func (*vimDoc) CodeSpan(out *bytes.Buffer, text []byte) { - r := regexp.MustCompile(`\s`) - - // vim does not correctly highlight space-delimited words in code spans - if !r.Match(text) { - out.WriteString("`") - out.Write(text) - out.WriteString("`") - } + out.WriteString("`") + out.Write(text) + out.WriteString("`") } func (*vimDoc) DoubleEmphasis(out *bytes.Buffer, text []byte) {