[PR #3354] [MERGED] Rework special link parsing in the post-processing of markup #16903

Closed
opened 2025-11-02 12:21:46 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/3354
Author: @thehowl
Created: 1/11/2018
Status: Merged
Merged: 2/27/2018
Merged by: @lafriks

Base: masterHead: fix-3327


📝 Commits (10+)

  • 38aca97 Get rid of autolink
  • 0c86b94 autolink in markdown
  • 4b2be0b Replace email addresses with mailto links
  • 49c7156 better handling of links
  • f55b2d9 Remove autolink.js from footer
  • fcf05be Refactor entire html.go
  • e0a3ee2 fix some bugs
  • 85f227f Make tests green, move what we can to html_internal_test, various other changes to processor logic
  • dc9f467 Make markdown tests work again
  • 00060dd Fix failing markdown tests in routers/api/v1/misc

📊 Changes

12 files changed (+1010 additions, -1006 deletions)

View changed files

📝 modules/markup/html.go (+502 -392)
modules/markup/html_internal_test.go (+382 -0)
📝 modules/markup/html_test.go (+65 -400)
📝 modules/markup/markdown/markdown.go (+28 -22)
📝 modules/markup/markdown/markdown_test.go (+7 -95)
📝 modules/markup/markup.go (+7 -1)
📝 modules/templates/helper.go (+17 -25)
📝 public/js/index.js (+0 -2)
public/vendor/plugins/autolink/LICENSE (+0 -21)
public/vendor/plugins/autolink/autolink.js (+0 -45)
📝 routers/api/v1/misc/markdown_test.go (+2 -2)
📝 templates/base/footer.tmpl (+0 -1)

📄 Description

Fixes #3327. Adds the ability to link emails in markdown, both a@b.com, <a@b.com> and [hello](mailto:a@b.com), all of which previously didn't work. Also removed the autolink js library, as the link processing can be very easily done on the backend using a very simple blackfriday option.

Closes #3364. Closes #652.

In the new mechanism, the post processing is done by passing the input through a given set of functions, passed to a new postProcessCtx. This enables the ability to customise the post-processing features to enable, and thus also closes #2968. It also enables in the commit message many other features, such as linking, writing emails, and basically everything PostProcess does except for shortlinks.

Closes #3112 as well.

The only thing that seems to be needed is some unit tests, but this should be on its way for 1.5


🔄 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/3354 **Author:** [@thehowl](https://github.com/thehowl) **Created:** 1/11/2018 **Status:** ✅ Merged **Merged:** 2/27/2018 **Merged by:** [@lafriks](https://github.com/lafriks) **Base:** `master` ← **Head:** `fix-3327` --- ### 📝 Commits (10+) - [`38aca97`](https://github.com/go-gitea/gitea/commit/38aca97ac903769cde5771c98c1caf923f4ae5e8) Get rid of autolink - [`0c86b94`](https://github.com/go-gitea/gitea/commit/0c86b9477926919a3216ff0641bef561c7c8c946) autolink in markdown - [`4b2be0b`](https://github.com/go-gitea/gitea/commit/4b2be0b0776f07744cc75662fab5c435616ab971) Replace email addresses with mailto links - [`49c7156`](https://github.com/go-gitea/gitea/commit/49c71568f79512547645e2473e3277489b0dc0dc) better handling of links - [`f55b2d9`](https://github.com/go-gitea/gitea/commit/f55b2d9b7df32391c5ec271c7dd7f86a82fa701c) Remove autolink.js from footer - [`fcf05be`](https://github.com/go-gitea/gitea/commit/fcf05bed5900d45c877562ae07b2710ca243a6c1) Refactor entire html.go - [`e0a3ee2`](https://github.com/go-gitea/gitea/commit/e0a3ee2df1204a5926dcb79ebe48ff4006f583b8) fix some bugs - [`85f227f`](https://github.com/go-gitea/gitea/commit/85f227f7058ecf88044ea0437e7a32f8d6b52248) Make tests green, move what we can to html_internal_test, various other changes to processor logic - [`dc9f467`](https://github.com/go-gitea/gitea/commit/dc9f467f2dfce649fe9217797d06c6f15b7d4c86) Make markdown tests work again - [`00060dd`](https://github.com/go-gitea/gitea/commit/00060dd3b3797042411e259b72b54bf23b468ca8) Fix failing markdown tests in routers/api/v1/misc ### 📊 Changes **12 files changed** (+1010 additions, -1006 deletions) <details> <summary>View changed files</summary> 📝 `modules/markup/html.go` (+502 -392) ➕ `modules/markup/html_internal_test.go` (+382 -0) 📝 `modules/markup/html_test.go` (+65 -400) 📝 `modules/markup/markdown/markdown.go` (+28 -22) 📝 `modules/markup/markdown/markdown_test.go` (+7 -95) 📝 `modules/markup/markup.go` (+7 -1) 📝 `modules/templates/helper.go` (+17 -25) 📝 `public/js/index.js` (+0 -2) ➖ `public/vendor/plugins/autolink/LICENSE` (+0 -21) ➖ `public/vendor/plugins/autolink/autolink.js` (+0 -45) 📝 `routers/api/v1/misc/markdown_test.go` (+2 -2) 📝 `templates/base/footer.tmpl` (+0 -1) </details> ### 📄 Description Fixes #3327. Adds the ability to link emails in markdown, both `a@b.com`, `<a@b.com>` and `[hello](mailto:a@b.com)`, all of which previously didn't work. Also removed the autolink js library, as the link processing can be very easily done on the backend using a very simple blackfriday option. Closes #3364. Closes #652. In the new mechanism, the post processing is done by passing the input through a given set of functions, passed to a new `postProcessCtx`. This enables the ability to customise the post-processing features to enable, and thus also closes #2968. It also enables in the commit message many other features, such as linking, writing emails, and basically everything PostProcess does except for shortlinks. Closes #3112 as well. The only thing that seems to be needed is some unit tests, but this should be on its way for 1.5 --- <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 12:21:46 -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#16903