mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-26 22:04:32 +02:00
Document and clean SourceRelativeLinksEval code
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
819271cb78
commit
1648e327c0
@@ -43,29 +43,31 @@ var SummaryDivider = []byte("<!--more-->")
|
||||
|
||||
// Blackfriday holds configuration values for Blackfriday rendering.
|
||||
type Blackfriday struct {
|
||||
Smartypants bool
|
||||
AngledQuotes bool
|
||||
Fractions bool
|
||||
HrefTargetBlank bool
|
||||
SmartDashes bool
|
||||
LatexDashes bool
|
||||
PlainIDAnchors bool
|
||||
SourceRelativeLinksEval bool
|
||||
Extensions []string
|
||||
ExtensionsMask []string
|
||||
Smartypants bool
|
||||
AngledQuotes bool
|
||||
Fractions bool
|
||||
HrefTargetBlank bool
|
||||
SmartDashes bool
|
||||
LatexDashes bool
|
||||
PlainIDAnchors bool
|
||||
SourceRelativeLinksEval bool
|
||||
SourceRelativeLinksProjectFolder string
|
||||
Extensions []string
|
||||
ExtensionsMask []string
|
||||
}
|
||||
|
||||
// NewBlackfriday creates a new Blackfriday filled with site config or some sane defaults.
|
||||
func NewBlackfriday() *Blackfriday {
|
||||
combinedParam := map[string]interface{}{
|
||||
"smartypants": true,
|
||||
"angledQuotes": false,
|
||||
"fractions": true,
|
||||
"hrefTargetBlank": false,
|
||||
"smartDashes": true,
|
||||
"latexDashes": true,
|
||||
"plainIDAnchors": false,
|
||||
"sourceRelativeLinks": false,
|
||||
"smartypants": true,
|
||||
"angledQuotes": false,
|
||||
"fractions": true,
|
||||
"hrefTargetBlank": false,
|
||||
"smartDashes": true,
|
||||
"latexDashes": true,
|
||||
"plainIDAnchors": false,
|
||||
"sourceRelativeLinks": false,
|
||||
"sourceRelativeLinksProjectFolder": "/docs/content",
|
||||
}
|
||||
|
||||
siteParam := viper.GetStringMap("blackfriday")
|
||||
|
@@ -49,6 +49,7 @@ func (renderer *HugoHTMLRenderer) Link(out *bytes.Buffer, link []byte, title []b
|
||||
// Use the blackfriday built in Link handler
|
||||
renderer.Renderer.Link(out, link, title, content)
|
||||
} else {
|
||||
// set by SourceRelativeLinksEval
|
||||
newLink, err := renderer.LinkResolver(string(link))
|
||||
if err != nil {
|
||||
newLink = string(link)
|
||||
@@ -62,6 +63,7 @@ func (renderer *HugoHTMLRenderer) Image(out *bytes.Buffer, link []byte, title []
|
||||
// Use the blackfriday built in Image handler
|
||||
renderer.Renderer.Image(out, link, title, alt)
|
||||
} else {
|
||||
// set by SourceRelativeLinksEval
|
||||
newLink, err := renderer.FileResolver(string(link))
|
||||
if err != nil {
|
||||
newLink = string(link)
|
||||
|
Reference in New Issue
Block a user