diff --git a/markdown.go b/markdown.go index 28305a1..ac1e1e0 100644 --- a/markdown.go +++ b/markdown.go @@ -330,9 +330,9 @@ func parse_inline(ob *bytes.Buffer, rndr *render, data []byte) { } if rndr.mk.normal_text != nil { - rndr.mk.normal_text(ob, data[i:], rndr.mk.opaque) + rndr.mk.normal_text(ob, data[i:end], rndr.mk.opaque) } else { - ob.Write(data[i:]) + ob.Write(data[i:end]) } if end >= len(data) { @@ -439,7 +439,7 @@ func char_codespan(ob *bytes.Buffer, rndr *render, data []byte, offset int) int return 0 } if f_begin < f_end { - if rndr.mk.codespan(ob, data[f_end:f_end], rndr.mk.opaque) == 0 { + if rndr.mk.codespan(ob, data[f_begin:f_end], rndr.mk.opaque) == 0 { end = 0 } } else { @@ -1048,9 +1048,9 @@ func find_emph_char(data []byte, c byte) int { for i < len(data) && data[i] != c && data[i] != '`' && data[i] != '[' { i++ } - if i >= len(data) { - return 0 - } + if i >= len(data) { + return 0 + } if data[i] == c { return i } @@ -2404,6 +2404,12 @@ func rndr_blockcode(ob *bytes.Buffer, text []byte, lang string, opaque interface ob.WriteString("\n") } +func rndr_blockquote(ob *bytes.Buffer, text []byte, opaque interface{}) { + ob.WriteString("
\n") + ob.Write(text) + ob.WriteString("\n") +} + func rndr_table(ob *bytes.Buffer, header []byte, body []byte, opaque interface{}) { if ob.Len() > 0 { ob.WriteByte('\n') @@ -2516,16 +2522,136 @@ func rndr_paragraph(ob *bytes.Buffer, text []byte, opaque interface{}) { ob.WriteString("\n") } -func rndr_emphasis(ob *bytes.Buffer, text []byte, opaque interface{}) int { - if len(text) == 0 { - return 0 - } - ob.WriteString("") - ob.Write(text) - ob.WriteString("") - return 1 +func rndr_autolink(ob *bytes.Buffer, text []byte, kind int, opaque interface{}) int { + return 1 } +func rndr_codespan(ob *bytes.Buffer, text []byte, opaque interface{}) int { + ob.WriteString("
")
+ attr_escape(ob, text)
+ ob.WriteString("
")
+ return 1
+}
+
+func rndr_double_emphasis(ob *bytes.Buffer, text []byte, opaque interface{}) int {
+ if len(text) == 0 {
+ return 0
+ }
+ ob.WriteString("")
+ ob.Write(text)
+ ob.WriteString("")
+ return 1
+}
+
+func rndr_emphasis(ob *bytes.Buffer, text []byte, opaque interface{}) int {
+ if len(text) == 0 {
+ return 0
+ }
+ ob.WriteString("")
+ ob.Write(text)
+ ob.WriteString("")
+ return 1
+}
+
+func rndr_image(ob *bytes.Buffer, link []byte, title []byte, alt []byte, opaque interface{}) int {
+ return 1
+}
+
+func rndr_linebreak(ob *bytes.Buffer, opaque interface{}) int {
+ options := opaque.(*html_renderopts)
+ ob.WriteString("