diff options
author | zeripath <art27@cantab.net> | 2021-07-24 05:21:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-24 00:21:51 -0400 |
commit | f135a818f53d82a61f3d99d80e2a2384f00c51d2 (patch) | |
tree | b335f68ee5308bf7ad4b9246c0feb3d4948cb304 /modules/setting/markup.go | |
parent | 342f338bda2f728a869349e271a8b11ebc76372a (diff) | |
download | gitea-f135a818f53d82a61f3d99d80e2a2384f00c51d2.tar.gz gitea-f135a818f53d82a61f3d99d80e2a2384f00c51d2.zip |
Make Mermaid.js limit configurable (#16519)
* Make Mermaid.js limit configurable
Add `MERMAID_MAX_SOURCE_CHARACTERS` to `[markup]` settings
to make the maximum size of a mermaid render configurable.
Fix #16513
Signed-off-by: Andrew Thornton <art27@cantab.net>
* fixup! Make Mermaid.js limit configurable
* Update custom/conf/app.example.ini
Co-authored-by: silverwind <me@silverwind.io>
* Update docs/content/doc/advanced/config-cheat-sheet.en-us.md
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'modules/setting/markup.go')
-rw-r--r-- | modules/setting/markup.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/setting/markup.go b/modules/setting/markup.go index 31ec1dd2eb..0bf6797712 100644 --- a/modules/setting/markup.go +++ b/modules/setting/markup.go @@ -15,8 +15,9 @@ import ( // ExternalMarkupRenderers represents the external markup renderers var ( - ExternalMarkupRenderers []*MarkupRenderer - ExternalSanitizerRules []MarkupSanitizerRule + ExternalMarkupRenderers []*MarkupRenderer + ExternalSanitizerRules []MarkupSanitizerRule + MermaidMaxSourceCharacters int ) // MarkupRenderer defines the external parser configured in ini @@ -40,6 +41,7 @@ type MarkupSanitizerRule struct { } func newMarkup() { + MermaidMaxSourceCharacters = Cfg.Section("markup").Key("MERMAID_MAX_SOURCE_CHARACTERS").MustInt(5000) ExternalMarkupRenderers = make([]*MarkupRenderer, 0, 10) ExternalSanitizerRules = make([]MarkupSanitizerRule, 0, 10) |