From 7e20f1cb5b3ef494676f3629e4980c8cdd64525b Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 22 Apr 2020 00:13:56 +0200 Subject: [PATCH] enable ENABLE_HARD_LINE_BREAK by default (#11162) enable ENABLE_HARD_LINE_BREAK by default This matches GitHub's rendering. Fix #11155 --- custom/conf/app.ini.sample | 6 ++++-- docs/content/doc/advanced/config-cheat-sheet.en-us.md | 4 +++- modules/markup/markdown/markdown_test.go | 4 ++-- modules/setting/setting.go | 2 +- routers/api/v1/misc/markdown_test.go | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample index 556f93a91d..414cd3f278 100644 --- a/custom/conf/app.ini.sample +++ b/custom/conf/app.ini.sample @@ -201,8 +201,10 @@ DESCRIPTION = Gitea (Git with a cup of tea) is a painless self-hosted Git servic KEYWORDS = go,git,self-hosted,gitea [markdown] -; Enable hard line break extension -ENABLE_HARD_LINE_BREAK = false +; Render soft line breaks as hard line breaks, which means a single newline character between +; paragraphs will cause a line break and adding trailing whitespace to paragraphs is not +; necessary to force a line break. +ENABLE_HARD_LINE_BREAK = true ; Comma separated list of custom URL-Schemes that are allowed as links when rendering Markdown ; for example git,magnet,ftp (more at https://en.wikipedia.org/wiki/List_of_URI_schemes) ; URLs starting with http and https are always displayed, whatever is put in this entry. diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 00f086e546..7d59041ec4 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -142,7 +142,9 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. ## Markdown (`markdown`) -- `ENABLE_HARD_LINE_BREAK`: **false**: Enable Markdown's hard line break extension. +- `ENABLE_HARD_LINE_BREAK`: **true**: Render soft line breaks as hard line breaks, which + means a single newline character between paragraphs will cause a line break and adding + trailing whitespace to paragraphs is not necessary to force a line break. - `CUSTOM_URL_SCHEMES`: Use a comma separated list (ftp,git,svn) to indicate additional URL hyperlinks to be rendered in Markdown. URLs beginning in http and https are always displayed diff --git a/modules/markup/markdown/markdown_test.go b/modules/markup/markdown/markdown_test.go index b2cf529964..160a344bda 100644 --- a/modules/markup/markdown/markdown_test.go +++ b/modules/markup/markdown/markdown_test.go @@ -133,9 +133,9 @@ func testAnswers(baseURLContent, baseURLImages string) []string { `, `

Excelsior JET allows you to create native executables for Windows, Linux and Mac OS X.

    -
  1. Package your libGDX application +
  2. Package your libGDX application
    images/1.png
  3. -
  4. Perform a test run by hitting the Run! button. +
  5. Perform a test run by hitting the Run! button.
    images/2.png

More tests

diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 74f6da38d1..a18b47a7e9 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -241,7 +241,7 @@ var ( CustomURLSchemes []string `ini:"CUSTOM_URL_SCHEMES"` FileExtensions []string }{ - EnableHardLineBreak: false, + EnableHardLineBreak: true, FileExtensions: strings.Split(".md,.markdown,.mdown,.mkd", ","), } diff --git a/routers/api/v1/misc/markdown_test.go b/routers/api/v1/misc/markdown_test.go index 6c81ec8eb4..264a6010f9 100644 --- a/routers/api/v1/misc/markdown_test.go +++ b/routers/api/v1/misc/markdown_test.go @@ -94,7 +94,7 @@ Here are some links to the most important topics. You can find the full list of

Wine Staging on website wine-staging.com.

Here are some links to the most important topics. You can find the full list of pages at the sidebar.

-

Configuration +

Configuration
images/icon-bug.png

`, // Guard wiki sidebar: special syntax