mirror of
https://gitee.com/gitea/gitea.git
synced 2024-11-30 10:47:40 +08:00
#1009 Config option for preserving hard line breaks
This commit is contained in:
parent
50dbc2732b
commit
90a6553c37
@ -18,6 +18,10 @@ EXPLORE_PAGING_NUM = 20
|
||||
; Number of issues that are showed in one page
|
||||
ISSUE_PAGING_NUM = 10
|
||||
|
||||
[markdown]
|
||||
; Enable hard line break extension
|
||||
ENABLE_HARD_LINE_BREAK = false
|
||||
|
||||
[server]
|
||||
PROTOCOL = http
|
||||
DOMAIN = localhost
|
||||
|
@ -201,6 +201,10 @@ func RenderRawMarkdown(body []byte, urlPrefix string) []byte {
|
||||
extensions |= blackfriday.EXTENSION_SPACE_HEADERS
|
||||
extensions |= blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK
|
||||
|
||||
if setting.Markdown.EnableHardLineBreak {
|
||||
extensions |= blackfriday.EXTENSION_HARD_LINE_BREAK
|
||||
}
|
||||
|
||||
body = blackfriday.Markdown(body, renderer, extensions)
|
||||
return body
|
||||
}
|
||||
|
@ -94,6 +94,11 @@ var (
|
||||
ExplorePagingNum int
|
||||
IssuePagingNum int
|
||||
|
||||
// Markdown sttings.
|
||||
Markdown struct {
|
||||
EnableHardLineBreak bool
|
||||
}
|
||||
|
||||
// Picture settings.
|
||||
PictureService string
|
||||
AvatarUploadPath string
|
||||
@ -353,8 +358,9 @@ func NewConfigContext() {
|
||||
AnsiCharset = sec.Key("ANSI_CHARSET").MustString("")
|
||||
|
||||
// UI settings.
|
||||
ExplorePagingNum = Cfg.Section("ui").Key("EXPLORE_PAGING_NUM").MustInt(20)
|
||||
IssuePagingNum = Cfg.Section("ui").Key("ISSUE_PAGING_NUM").MustInt(10)
|
||||
sec = Cfg.Section("ui")
|
||||
ExplorePagingNum = sec.Key("EXPLORE_PAGING_NUM").MustInt(20)
|
||||
IssuePagingNum = sec.Key("ISSUE_PAGING_NUM").MustInt(10)
|
||||
|
||||
sec = Cfg.Section("picture")
|
||||
PictureService = sec.Key("SERVICE").In("server", []string{"server"})
|
||||
@ -376,7 +382,9 @@ func NewConfigContext() {
|
||||
DisableGravatar = true
|
||||
}
|
||||
|
||||
if err = Cfg.Section("git").MapTo(&Git); err != nil {
|
||||
if err = Cfg.Section("markdown").MapTo(&Markdown); err != nil {
|
||||
log.Fatal(4, "Fail to map Markdown settings: %v", err)
|
||||
} else if err = Cfg.Section("git").MapTo(&Git); err != nil {
|
||||
log.Fatal(4, "Fail to map Git settings: %v", err)
|
||||
} else if Cfg.Section("cron").MapTo(&Cron); err != nil {
|
||||
log.Fatal(4, "Fail to map Cron settings: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user