[PR #5201] [MERGED] Pass link prefixes to external markup parsers #17695

Closed
opened 2025-11-02 15:04:41 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/5201
Author: @Eisfunke
Created: 10/27/2018
Status: Merged
Merged: 10/30/2018
Merged by: @techknowlogick

Base: masterHead: link-prefix


📝 Commits (10+)

  • 4dacc4a Pass environment variables for URL prefixes to external markup parser
  • cb102ef Document external markup link prefix environment variables
  • 2c744a2 Run format on link prefix changes
  • ab49294 Merge branch 'master' into link-prefix
  • b1695ce Merge branch 'master' into link-prefix
  • bd09432 Merge branch 'master' into link-prefix
  • 35d7477 Merge branch 'master' into link-prefix
  • 21fd116 Merge branch 'master' into link-prefix
  • 264bc0e Merge branch 'master' into link-prefix
  • 24cdf6f Merge branch 'master' into link-prefix

📊 Changes

2 files changed (+9 additions, -0 deletions)

View changed files

📝 docs/content/doc/advanced/config-cheat-sheet.en-us.md (+4 -0)
📝 modules/markup/external/external.go (+5 -0)

📄 Description

Should close #5031.

This passes the current URL prefixes to external markup parsers as environment variables.

GITEA_PREFIX_SRC is the current link prefix in the src path tree, GITEA_PREFIX_RAW is the prefix for images in the raw path tree.

The raw prefix is obtained by string replacement. That's not quite elegant, but it's what markdown.go does, so I copied that.

I tested the change with Pandoc as markdown parser, and I was able to get links and images working using the environment variables.

Signed-off-by: Nicolas Lenz nicolas@eisfunke.com


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/5201 **Author:** [@Eisfunke](https://github.com/Eisfunke) **Created:** 10/27/2018 **Status:** ✅ Merged **Merged:** 10/30/2018 **Merged by:** [@techknowlogick](https://github.com/techknowlogick) **Base:** `master` ← **Head:** `link-prefix` --- ### 📝 Commits (10+) - [`4dacc4a`](https://github.com/go-gitea/gitea/commit/4dacc4a010d399235a877dea05b1c45ba7fc43df) Pass environment variables for URL prefixes to external markup parser - [`cb102ef`](https://github.com/go-gitea/gitea/commit/cb102ef279957b963b593ec6acea615e029f5722) Document external markup link prefix environment variables - [`2c744a2`](https://github.com/go-gitea/gitea/commit/2c744a2cda2b8d544d35d6de6fa194685527616c) Run format on link prefix changes - [`ab49294`](https://github.com/go-gitea/gitea/commit/ab4929482535b47e287aa4b9a97eba5c0f0dd761) Merge branch 'master' into link-prefix - [`b1695ce`](https://github.com/go-gitea/gitea/commit/b1695ce9004e5d10cfb9d7a82e280f1e8305336c) Merge branch 'master' into link-prefix - [`bd09432`](https://github.com/go-gitea/gitea/commit/bd09432e1b26a117915d313dadc8c99fe817461e) Merge branch 'master' into link-prefix - [`35d7477`](https://github.com/go-gitea/gitea/commit/35d7477cbcb9fc7e5d95ef7e0f9cc2d3372744bf) Merge branch 'master' into link-prefix - [`21fd116`](https://github.com/go-gitea/gitea/commit/21fd116bd77397b51a79b8f6b6d2678907a41264) Merge branch 'master' into link-prefix - [`264bc0e`](https://github.com/go-gitea/gitea/commit/264bc0e98aa2300bf9e3a0129c971c264603d811) Merge branch 'master' into link-prefix - [`24cdf6f`](https://github.com/go-gitea/gitea/commit/24cdf6ffb1db46b439674873fcf82e84f2c3a1ec) Merge branch 'master' into link-prefix ### 📊 Changes **2 files changed** (+9 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/doc/advanced/config-cheat-sheet.en-us.md` (+4 -0) 📝 `modules/markup/external/external.go` (+5 -0) </details> ### 📄 Description Should close #5031. This passes the current URL prefixes to external markup parsers as environment variables. `GITEA_PREFIX_SRC` is the current link prefix in the `src` path tree, `GITEA_PREFIX_RAW` is the prefix for images in the `raw` path tree. The `raw` prefix is obtained by string replacement. That's not quite elegant, but it's what `markdown.go` does, so I copied that. I tested the change with Pandoc as markdown parser, and I was able to get links and images working using the environment variables. Signed-off-by: Nicolas Lenz <nicolas@eisfunke.com> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 15:04:41 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#17695