Skip to content

Refactor markup render to fix various path problems #34114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 4, 2025

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Apr 3, 2025

  • Fix markdown href relative link issue #33972
    • Use consistent path resolving for links and medias.
    • No need to make the markup renders to resolve the paths, instead, the paths are all correctly resolved in the "post process" step.
  • Fix Markdown links started with / broken in 1.23 #33274
    • Since 1.23, all paths starting with "/" are relative to current render context (for example: the current repo branch)
    • Introduce /:root/path-relative-to-root, then the path will be rendered as relative to "ROOT_URL"

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 3, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Apr 3, 2025
@wxiaoguang wxiaoguang force-pushed the fix-markdown branch 3 times, most recently from af68665 to 7501ee5 Compare April 3, 2025 16:27
@pull-request-size pull-request-size bot added size/XL and removed size/L labels Apr 3, 2025
@wxiaoguang wxiaoguang changed the title Refactor markdown to fix various path problems Refactor markup render to fix various path problems Apr 3, 2025
@wxiaoguang wxiaoguang force-pushed the fix-markdown branch 2 times, most recently from ec1a7d3 to 986b6cf Compare April 3, 2025 17:13
@github-actions github-actions bot added the modifies/api This PR adds API routes or modifies them label Apr 3, 2025
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 3, 2025
@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Apr 3, 2025
@hiifong
Copy link
Member

hiifong commented Apr 4, 2025

Path /:root/static/gitea-push-hint.png, doesn't work.

I'm not sure I'm typing this correctly.

image

image

@wxiaoguang

This comment was marked as off-topic.

@hiifong

This comment was marked as off-topic.

@wxiaoguang

This comment was marked as off-topic.

@hiifong

This comment was marked as off-topic.

@wxiaoguang

This comment was marked as off-topic.

@hiifong

This comment was marked as off-topic.

@wxiaoguang

This comment was marked as off-topic.

@hiifong

This comment was marked as off-topic.

@wxiaoguang

This comment was marked as off-topic.

@hiifong

This comment was marked as off-topic.

@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented Apr 4, 2025

  • Since 1.23, all paths starting with "/" are relative to current render context (for example: the current repo branch)
  • Introduce /:root/path-relative-to-root, then the path will be rendered as relative to "ROOT_URL"

I updated the description to this


<img src="/docs/static/gitea-push-hint.png">

ps: this link is only a demo, I don't know the real path in your repo.

If the file path is static/gitea-push-hint.png in the git repo, you need to write <img src="/static/gitea-push-hint.png">.

@wxiaoguang wxiaoguang added this to the 1.24.0 milestone Apr 4, 2025
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 4, 2025
@wxiaoguang wxiaoguang merged commit 6cee3bf into go-gitea:main Apr 4, 2025
26 checks passed
@wxiaoguang wxiaoguang deleted the fix-markdown branch April 4, 2025 15:45
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 8, 2025
* giteaofficial/main:
  [skip ci] Updated translations via Crowdin
  docs: add Chinese translations for README files (go-gitea#34132)
  Keep file tree view icons consistent with icon theme (go-gitea#33921)
  Make markdown render match GitHub's behavior (go-gitea#34129)
  Remove dead code: RepoRef (go-gitea#34131)
  Correctly handle submodule view and avoid throwing 500 error (go-gitea#34121)
  Use `overflow-wrap: anywhere` to replace `word-break: break-all` (go-gitea#34126)
  Fix markdown render behaviors (go-gitea#34122)
  Refactor dropdown ellipsis (go-gitea#34123)
  Avoid creating unnecessary temporary cat file sub process (go-gitea#33942)
  Fix discord webhook 400 status code when description limit is exceeded (go-gitea#34084)
  Refactor markup render to fix various path problems (go-gitea#34114)
  [skip ci] Updated translations via Crowdin
  Fix invalid version in RPM package path (go-gitea#34112)
  also check default ssh-cert location for host (go-gitea#34099) (go-gitea#34100)
  Fix markdown frontmatter rendering (go-gitea#34102)
  Get changed files based on merge base when checking `pull_request` actions trigger (go-gitea#34106)
  Add `last_committer_date` and `last_author_date` for file contents API (go-gitea#32921)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

markdown href relative link issue Markdown links started with / broken in 1.23
4 participants