Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
7173764d
Commit
7173764d
authored
Aug 04, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
markdown: Render lists as part of summary (upstream bug workaround)
See github.com/russross/blackfriday/issues/189
parent
e4643f04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
33 deletions
+41
-33
middleware/markdown/page.go
middleware/markdown/page.go
+1
-1
middleware/markdown/renderer.go
middleware/markdown/renderer.go
+40
-32
No files found.
middleware/markdown/page.go
View file @
7173764d
...
...
@@ -142,7 +142,7 @@ func (l *linkGen) generateLinks(md Markdown, cfg *Config) bool {
Title
:
metadata
.
Title
,
URL
:
reqPath
,
Date
:
metadata
.
Date
,
Summary
:
string
(
blackfriday
.
Markdown
(
summary
,
Plaintext
Renderer
{},
0
)),
Summary
:
string
(
blackfriday
.
Markdown
(
summary
,
Summary
Renderer
{},
0
)),
})
break
// don't try other file extensions
...
...
middleware/markdown/renderer.go
View file @
7173764d
...
...
@@ -4,25 +4,33 @@ import (
"bytes"
)
type
Plaintext
Renderer
struct
{}
type
Summary
Renderer
struct
{}
// Block-level callbacks
func
(
r
Plaintext
Renderer
)
BlockCode
(
out
*
bytes
.
Buffer
,
text
[]
byte
,
lang
string
)
{}
func
(
r
Summary
Renderer
)
BlockCode
(
out
*
bytes
.
Buffer
,
text
[]
byte
,
lang
string
)
{}
func
(
r
Plaintext
Renderer
)
BlockQuote
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{}
func
(
r
Summary
Renderer
)
BlockQuote
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{}
func
(
r
Plaintext
Renderer
)
BlockHtml
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{}
func
(
r
Summary
Renderer
)
BlockHtml
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{}
func
(
r
Plaintext
Renderer
)
Header
(
out
*
bytes
.
Buffer
,
text
func
()
bool
,
level
int
,
id
string
)
{}
func
(
r
Summary
Renderer
)
Header
(
out
*
bytes
.
Buffer
,
text
func
()
bool
,
level
int
,
id
string
)
{}
func
(
r
Plaintext
Renderer
)
HRule
(
out
*
bytes
.
Buffer
)
{}
func
(
r
Summary
Renderer
)
HRule
(
out
*
bytes
.
Buffer
)
{}
func
(
r
PlaintextRenderer
)
List
(
out
*
bytes
.
Buffer
,
text
func
()
bool
,
flags
int
)
{}
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
{
' '
})
}
func
(
r
Plaintext
Renderer
)
ListItem
(
out
*
bytes
.
Buffer
,
text
[]
byte
,
flags
int
)
{}
func
(
r
Summary
Renderer
)
ListItem
(
out
*
bytes
.
Buffer
,
text
[]
byte
,
flags
int
)
{}
func
(
r
Plaintext
Renderer
)
Paragraph
(
out
*
bytes
.
Buffer
,
text
func
()
bool
)
{
func
(
r
Summary
Renderer
)
Paragraph
(
out
*
bytes
.
Buffer
,
text
func
()
bool
)
{
marker
:=
out
.
Len
()
if
!
text
()
{
out
.
Truncate
(
marker
)
...
...
@@ -30,68 +38,68 @@ func (r PlaintextRenderer) Paragraph(out *bytes.Buffer, text func() bool) {
out
.
Write
([]
byte
{
' '
})
}
func
(
r
Plaintext
Renderer
)
Table
(
out
*
bytes
.
Buffer
,
header
[]
byte
,
body
[]
byte
,
columnData
[]
int
)
{}
func
(
r
Summary
Renderer
)
Table
(
out
*
bytes
.
Buffer
,
header
[]
byte
,
body
[]
byte
,
columnData
[]
int
)
{}
func
(
r
Plaintext
Renderer
)
TableRow
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{}
func
(
r
Summary
Renderer
)
TableRow
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{}
func
(
r
Plaintext
Renderer
)
TableHeaderCell
(
out
*
bytes
.
Buffer
,
text
[]
byte
,
flags
int
)
{}
func
(
r
Summary
Renderer
)
TableHeaderCell
(
out
*
bytes
.
Buffer
,
text
[]
byte
,
flags
int
)
{}
func
(
r
Plaintext
Renderer
)
TableCell
(
out
*
bytes
.
Buffer
,
text
[]
byte
,
flags
int
)
{}
func
(
r
Summary
Renderer
)
TableCell
(
out
*
bytes
.
Buffer
,
text
[]
byte
,
flags
int
)
{}
func
(
r
Plaintext
Renderer
)
Footnotes
(
out
*
bytes
.
Buffer
,
text
func
()
bool
)
{}
func
(
r
Summary
Renderer
)
Footnotes
(
out
*
bytes
.
Buffer
,
text
func
()
bool
)
{}
func
(
r
Plaintext
Renderer
)
FootnoteItem
(
out
*
bytes
.
Buffer
,
name
,
text
[]
byte
,
flags
int
)
{}
func
(
r
Summary
Renderer
)
FootnoteItem
(
out
*
bytes
.
Buffer
,
name
,
text
[]
byte
,
flags
int
)
{}
func
(
r
Plaintext
Renderer
)
TitleBlock
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{}
func
(
r
Summary
Renderer
)
TitleBlock
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{}
// Span-level callbacks
func
(
r
Plaintext
Renderer
)
AutoLink
(
out
*
bytes
.
Buffer
,
link
[]
byte
,
kind
int
)
{}
func
(
r
Summary
Renderer
)
AutoLink
(
out
*
bytes
.
Buffer
,
link
[]
byte
,
kind
int
)
{}
func
(
r
Plaintext
Renderer
)
CodeSpan
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{
func
(
r
Summary
Renderer
)
CodeSpan
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{
out
.
Write
([]
byte
(
"`"
))
out
.
Write
(
text
)
out
.
Write
([]
byte
(
"`"
))
}
func
(
r
Plaintext
Renderer
)
DoubleEmphasis
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{
func
(
r
Summary
Renderer
)
DoubleEmphasis
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{
out
.
Write
(
text
)
}
func
(
r
Plaintext
Renderer
)
Emphasis
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{
func
(
r
Summary
Renderer
)
Emphasis
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{
out
.
Write
(
text
)
}
func
(
r
Plaintext
Renderer
)
Image
(
out
*
bytes
.
Buffer
,
link
[]
byte
,
title
[]
byte
,
alt
[]
byte
)
{}
func
(
r
Summary
Renderer
)
Image
(
out
*
bytes
.
Buffer
,
link
[]
byte
,
title
[]
byte
,
alt
[]
byte
)
{}
func
(
r
Plaintext
Renderer
)
LineBreak
(
out
*
bytes
.
Buffer
)
{}
func
(
r
Summary
Renderer
)
LineBreak
(
out
*
bytes
.
Buffer
)
{}
func
(
r
Plaintext
Renderer
)
Link
(
out
*
bytes
.
Buffer
,
link
[]
byte
,
title
[]
byte
,
content
[]
byte
)
{
func
(
r
Summary
Renderer
)
Link
(
out
*
bytes
.
Buffer
,
link
[]
byte
,
title
[]
byte
,
content
[]
byte
)
{
out
.
Write
(
content
)
}
func
(
r
Plaintext
Renderer
)
RawHtmlTag
(
out
*
bytes
.
Buffer
,
tag
[]
byte
)
{}
func
(
r
Summary
Renderer
)
RawHtmlTag
(
out
*
bytes
.
Buffer
,
tag
[]
byte
)
{}
func
(
r
Plaintext
Renderer
)
TripleEmphasis
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{
func
(
r
Summary
Renderer
)
TripleEmphasis
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{
out
.
Write
(
text
)
}
func
(
r
Plaintext
Renderer
)
StrikeThrough
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{}
func
(
r
Summary
Renderer
)
StrikeThrough
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{}
func
(
r
Plaintext
Renderer
)
FootnoteRef
(
out
*
bytes
.
Buffer
,
ref
[]
byte
,
id
int
)
{}
func
(
r
Summary
Renderer
)
FootnoteRef
(
out
*
bytes
.
Buffer
,
ref
[]
byte
,
id
int
)
{}
// Low-level callbacks
func
(
r
Plaintext
Renderer
)
Entity
(
out
*
bytes
.
Buffer
,
entity
[]
byte
)
{
func
(
r
Summary
Renderer
)
Entity
(
out
*
bytes
.
Buffer
,
entity
[]
byte
)
{
out
.
Write
(
entity
)
}
func
(
r
Plaintext
Renderer
)
NormalText
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{
func
(
r
Summary
Renderer
)
NormalText
(
out
*
bytes
.
Buffer
,
text
[]
byte
)
{
out
.
Write
(
text
)
}
// Header and footer
func
(
r
Plaintext
Renderer
)
DocumentHeader
(
out
*
bytes
.
Buffer
)
{}
func
(
r
Summary
Renderer
)
DocumentHeader
(
out
*
bytes
.
Buffer
)
{}
func
(
r
Plaintext
Renderer
)
DocumentFooter
(
out
*
bytes
.
Buffer
)
{}
func
(
r
Summary
Renderer
)
DocumentFooter
(
out
*
bytes
.
Buffer
)
{}
func
(
r
Plaintext
Renderer
)
GetFlags
()
int
{
return
0
}
func
(
r
Summary
Renderer
)
GetFlags
()
int
{
return
0
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment