mirror of https://github.com/jlelse/GoBlog
Strip down Goldmark for titles, to just provide typographer and emoji support
This commit is contained in:
parent
663e6932bf
commit
4c1f7fcde4
16
markdown.go
16
markdown.go
|
@ -43,21 +43,15 @@ func (a *goBlog) initMarkdown() {
|
|||
}))...)
|
||||
a.titleMd = goldmark.New(
|
||||
goldmark.WithParser(
|
||||
// Override to disable lists
|
||||
// Override, no need for special Markdown parsers
|
||||
parser.NewParser(
|
||||
parser.WithBlockParsers(
|
||||
// util.Prioritized(parser.NewSetextHeadingParser(), 100),
|
||||
util.Prioritized(parser.NewThematicBreakParser(), 200),
|
||||
// util.Prioritized(parser.NewListParser(), 300),
|
||||
// util.Prioritized(parser.NewListItemParser(), 400),
|
||||
util.Prioritized(parser.NewCodeBlockParser(), 500),
|
||||
// util.Prioritized(parser.NewATXHeadingParser(), 600),
|
||||
util.Prioritized(parser.NewFencedCodeBlockParser(), 700),
|
||||
util.Prioritized(parser.NewBlockquoteParser(), 800),
|
||||
util.Prioritized(parser.NewHTMLBlockParser(), 900),
|
||||
util.Prioritized(parser.NewParagraphParser(), 1000)),
|
||||
parser.WithInlineParsers(parser.DefaultInlineParsers()...),
|
||||
parser.WithParagraphTransformers(parser.DefaultParagraphTransformers()...),
|
||||
parser.WithInlineParsers(
|
||||
util.Prioritized(parser.NewRawHTMLParser(), 400),
|
||||
),
|
||||
parser.WithParagraphTransformers(),
|
||||
),
|
||||
),
|
||||
goldmark.WithRendererOptions(
|
||||
|
|
|
@ -70,10 +70,9 @@ func Test_markdown(t *testing.T) {
|
|||
|
||||
// Title
|
||||
|
||||
renderedTitle := app.renderMdTitle("3. **Test**")
|
||||
if renderedTitle != "3. Test" {
|
||||
t.Errorf("Wrong result, got \"%v\"", renderedTitle)
|
||||
}
|
||||
assert.Equal(t, "3. **Test**", app.renderMdTitle("3. **Test**"))
|
||||
assert.Equal(t, "Test’s", app.renderMdTitle("Test's"))
|
||||
assert.Equal(t, "😂", app.renderMdTitle(":joy:"))
|
||||
|
||||
// Template func
|
||||
|
||||
|
|
Loading…
Reference in New Issue