2015-07-27 23:21:09 -05:00
|
|
|
package markdown
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
)
|
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
type SummaryRenderer struct{}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
|
|
|
// Block-level callbacks
|
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) BlockQuote(out *bytes.Buffer, text []byte) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) BlockHtml(out *bytes.Buffer, text []byte) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) Header(out *bytes.Buffer, text func() bool, level int, id string) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) HRule(out *bytes.Buffer) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) List(out *bytes.Buffer, text func() bool, flags int) {
|
|
|
|
// TODO: This is not desired (we'd rather not write lists as part of summary),
|
|
|
|
// but see this issue: https://github.com/russross/blackfriday/issues/189
|
|
|
|
marker := out.Len()
|
|
|
|
if !text() {
|
|
|
|
out.Truncate(marker)
|
|
|
|
}
|
|
|
|
out.Write([]byte{' '})
|
|
|
|
}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) ListItem(out *bytes.Buffer, text []byte, flags int) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) Paragraph(out *bytes.Buffer, text func() bool) {
|
2015-07-27 23:21:09 -05:00
|
|
|
marker := out.Len()
|
|
|
|
if !text() {
|
|
|
|
out.Truncate(marker)
|
|
|
|
}
|
|
|
|
out.Write([]byte{' '})
|
|
|
|
}
|
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) TableRow(out *bytes.Buffer, text []byte) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) TableHeaderCell(out *bytes.Buffer, text []byte, flags int) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) TableCell(out *bytes.Buffer, text []byte, flags int) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) Footnotes(out *bytes.Buffer, text func() bool) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) FootnoteItem(out *bytes.Buffer, name, text []byte, flags int) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) TitleBlock(out *bytes.Buffer, text []byte) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
|
|
|
// Span-level callbacks
|
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) CodeSpan(out *bytes.Buffer, text []byte) {
|
2015-07-29 18:41:52 -05:00
|
|
|
out.Write([]byte("`"))
|
|
|
|
out.Write(text)
|
|
|
|
out.Write([]byte("`"))
|
|
|
|
}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) DoubleEmphasis(out *bytes.Buffer, text []byte) {
|
2015-07-27 23:21:09 -05:00
|
|
|
out.Write(text)
|
|
|
|
}
|
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) Emphasis(out *bytes.Buffer, text []byte) {
|
2015-07-27 23:21:09 -05:00
|
|
|
out.Write(text)
|
|
|
|
}
|
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) LineBreak(out *bytes.Buffer) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
|
2015-07-27 23:21:09 -05:00
|
|
|
out.Write(content)
|
|
|
|
}
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) RawHtmlTag(out *bytes.Buffer, tag []byte) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) TripleEmphasis(out *bytes.Buffer, text []byte) {
|
2015-07-27 23:21:09 -05:00
|
|
|
out.Write(text)
|
|
|
|
}
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) StrikeThrough(out *bytes.Buffer, text []byte) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) FootnoteRef(out *bytes.Buffer, ref []byte, id int) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
|
|
|
// Low-level callbacks
|
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) Entity(out *bytes.Buffer, entity []byte) {
|
2015-07-27 23:21:09 -05:00
|
|
|
out.Write(entity)
|
|
|
|
}
|
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) NormalText(out *bytes.Buffer, text []byte) {
|
2015-07-27 23:21:09 -05:00
|
|
|
out.Write(text)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Header and footer
|
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) DocumentHeader(out *bytes.Buffer) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) DocumentFooter(out *bytes.Buffer) {}
|
2015-07-27 23:21:09 -05:00
|
|
|
|
2015-08-04 19:31:14 -05:00
|
|
|
func (r SummaryRenderer) GetFlags() int { return 0 }
|