Add modules, allow code blocks with spaces

Fixes #3
This commit is contained in:
Alex Yatskov 2021-06-13 11:54:43 -07:00
parent fda9d91aa9
commit fefa9e6745
3 changed files with 10 additions and 8 deletions

5
go.mod Normal file
View File

@ -0,0 +1,5 @@
module github.com/FooSoft/md2vim
go 1.16
require github.com/russross/blackfriday v1.6.0

2
go.sum Normal file
View File

@ -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=

View File

@ -318,14 +318,9 @@ func (*vimDoc) AutoLink(out *bytes.Buffer, link []byte, kind int) {
} }
func (*vimDoc) CodeSpan(out *bytes.Buffer, text []byte) { 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.WriteString("`")
out.Write(text) out.Write(text)
out.WriteString("`") out.WriteString("`")
}
} }
func (*vimDoc) DoubleEmphasis(out *bytes.Buffer, text []byte) { func (*vimDoc) DoubleEmphasis(out *bytes.Buffer, text []byte) {