ifcurl/forgejo/go.patch
Bruno Postle e02ba0e214 forgejo: complete patch directory with apply instructions
Add the missing Go source files and a README covering the full apply
procedure. Previously only custom assets and the test file were tracked
here; ifc_url.go and the two-file diff were only in the Forgejo tree.

- forgejo/modules/markup/markdown/ifc_url.go — goldmark extension source
- forgejo/go.patch — diff for markdown.go + markup.go (7 lines total)
- forgejo/README.md — step-by-step: apply patch, run tests, build,
  deploy assets, configure app.ini, upgrade procedure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 07:57:33 +01:00

31 lines
1.2 KiB
Diff

diff --git a/modules/markup/markdown/markdown.go b/modules/markup/markdown/markdown.go
index 2b19e0f1c9..12be3e1c24 100644
--- a/modules/markup/markdown/markdown.go
+++ b/modules/markup/markdown/markdown.go
@@ -116,6 +116,7 @@ func SpecializedMarkdown() goldmark.Markdown {
math.NewExtension(
math.Enabled(setting.Markdown.EnableMath),
),
+ NewIfcURLExtension(),
),
goldmark.WithParserOptions(
parser.WithAttribute(),
diff --git a/modules/setting/markup.go b/modules/setting/markup.go
index 4ab9e7b2d1..c1fad254b4 100644
--- a/modules/setting/markup.go
+++ b/modules/setting/markup.go
@@ -59,8 +59,14 @@ type MarkupSanitizerRule struct {
AllowDataURIImages bool
}
+// IfcURL holds configuration for the ifcurl preview service integration.
+var IfcURL = struct {
+ PreviewServiceURL string `ini:"PREVIEW_SERVICE_URL"`
+}{}
+
func loadMarkupFrom(rootCfg ConfigProvider) {
mustMapSetting(rootCfg, "markdown", &Markdown)
+ mustMapSetting(rootCfg, "ifcurl", &IfcURL)
MermaidMaxSourceCharacters = rootCfg.Section("markup").Key("MERMAID_MAX_SOURCE_CHARACTERS").MustInt(50000)
FilePreviewMaxLines = rootCfg.Section("markup").Key("FILEPREVIEW_MAX_LINES").MustInt(50)