mirror of
https://github.com/status-im/markdown.git
synced 2025-02-22 08:08:18 +00:00
gofmt
This commit is contained in:
parent
df64ec5d0f
commit
f3386eb849
2
block.go
2
block.go
@ -754,7 +754,7 @@ func blockCode(out *bytes.Buffer, rndr *render, data []byte) int {
|
|||||||
n++
|
n++
|
||||||
}
|
}
|
||||||
if n > 0 {
|
if n > 0 {
|
||||||
work.Truncate(len(workbytes)-n)
|
work.Truncate(len(workbytes) - n)
|
||||||
}
|
}
|
||||||
|
|
||||||
work.WriteByte('\n')
|
work.WriteByte('\n')
|
||||||
|
6
html.go
6
html.go
@ -35,7 +35,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type htmlOptions struct {
|
type htmlOptions struct {
|
||||||
flags int
|
flags int
|
||||||
closeTag string // how to end singleton tags: usually " />\n", possibly ">\n"
|
closeTag string // how to end singleton tags: usually " />\n", possibly ">\n"
|
||||||
tocData struct {
|
tocData struct {
|
||||||
headerCount int
|
headerCount int
|
||||||
@ -427,10 +427,10 @@ func htmlAutoLink(out *bytes.Buffer, link []byte, kind int, opaque interface{})
|
|||||||
* an actual URI, e.g. `mailto:foo@bar.com`, we don't
|
* an actual URI, e.g. `mailto:foo@bar.com`, we don't
|
||||||
* want to print the `mailto:` prefix
|
* want to print the `mailto:` prefix
|
||||||
*/
|
*/
|
||||||
switch {
|
switch {
|
||||||
case bytes.HasPrefix(link, []byte("mailto://")):
|
case bytes.HasPrefix(link, []byte("mailto://")):
|
||||||
attrEscape(out, link[9:])
|
attrEscape(out, link[9:])
|
||||||
case bytes.HasPrefix(link, []byte("mailto:")):
|
case bytes.HasPrefix(link, []byte("mailto:")):
|
||||||
attrEscape(out, link[7:])
|
attrEscape(out, link[7:])
|
||||||
default:
|
default:
|
||||||
attrEscape(out, link)
|
attrEscape(out, link)
|
||||||
|
32
inline.go
32
inline.go
@ -536,19 +536,19 @@ func inlineEntity(out *bytes.Buffer, rndr *render, data []byte, offset int) int
|
|||||||
}
|
}
|
||||||
|
|
||||||
func inlineAutoLink(out *bytes.Buffer, rndr *render, data []byte, offset int) int {
|
func inlineAutoLink(out *bytes.Buffer, rndr *render, data []byte, offset int) int {
|
||||||
// quick check to rule out most false hits on ':'
|
// quick check to rule out most false hits on ':'
|
||||||
if len(data) < offset + 3 || data[offset+1] != '/' || data[offset+2] != '/' {
|
if len(data) < offset+3 || data[offset+1] != '/' || data[offset+2] != '/' {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// scan backward for a word boundary
|
// scan backward for a word boundary
|
||||||
rewind := 0
|
rewind := 0
|
||||||
for offset - rewind > 0 && rewind <= 7 && !isspace(data[offset-rewind-1]) && !isspace(data[offset-rewind-1]) {
|
for offset-rewind > 0 && rewind <= 7 && !isspace(data[offset-rewind-1]) && !isspace(data[offset-rewind-1]) {
|
||||||
rewind++
|
rewind++
|
||||||
}
|
}
|
||||||
if rewind > 6 { // longest supported protocol is "mailto" which has 6 letters
|
if rewind > 6 { // longest supported protocol is "mailto" which has 6 letters
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_data := data
|
orig_data := data
|
||||||
data = data[offset-rewind:]
|
data = data[offset-rewind:]
|
||||||
@ -626,10 +626,10 @@ func inlineAutoLink(out *bytes.Buffer, rndr *render, data []byte, offset int) in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we were triggered on the ':', so we need to rewind the output a bit
|
// we were triggered on the ':', so we need to rewind the output a bit
|
||||||
if out.Len() >= rewind {
|
if out.Len() >= rewind {
|
||||||
out.Truncate(len(out.Bytes()) - rewind)
|
out.Truncate(len(out.Bytes()) - rewind)
|
||||||
}
|
}
|
||||||
|
|
||||||
if rndr.mk.AutoLink != nil {
|
if rndr.mk.AutoLink != nil {
|
||||||
var u_link bytes.Buffer
|
var u_link bytes.Buffer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user