Feature Request: return parsed markdown body (html body) via API #2945

Open
opened 2025-11-02 04:54:56 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @meteorlxy on GitHub (Feb 20, 2019).

Description

Currently, we can only get the raw body (markdown string) of issues/comments via API. i.e. the body field:

image

Hope we can generate parsed body (HTML string) via API.

  • Github API: use custom media type application/vnd.github.v3.html+json to return body_html field - REF
  • Gitlab API: have another markdown API to parse markdown string to HTML string by users - REF
  • Bitbucket API: return content.html by default - REF
Originally created by @meteorlxy on GitHub (Feb 20, 2019). ## Description Currently, we can only get the raw body (markdown string) of issues/comments via API. i.e. the `body` field: ![image](https://user-images.githubusercontent.com/18205362/53071891-7df4d880-351e-11e9-8263-a54ff335b53a.png) Hope we can generate parsed body (HTML string) via API. - Github API: use custom media type `application/vnd.github.v3.html+json` to return `body_html` field - [REF](https://developer.github.com/v3/issues/comments/#custom-media-types) - Gitlab API: have another `markdown` API to parse markdown string to HTML string by users - [REF](https://docs.gitlab.com/ce/api/markdown.html) - Bitbucket API: return `content.html` by default - [REF](https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/issues/%7Bissue_id%7D/comments#get)
GiteaMirror added the type/proposaltype/enhancement labels 2025-11-02 04:54:56 -06:00
Author
Owner

@westurner commented on GitHub (Mar 3, 2019):

How does /api/v1/markdown work?

@westurner commented on GitHub (Mar 3, 2019): How does `/api/v1/markdown` work?
Author
Owner

@meteorlxy commented on GitHub (Mar 3, 2019):

It's similar to Gitlab's implementation.

It works, but when fetching list of comments, we have to call /api/v1/markdown several times.

@meteorlxy commented on GitHub (Mar 3, 2019): It's similar to Gitlab's implementation. It works, but when fetching list of comments, we have to call `/api/v1/markdown` several times.
Author
Owner

@westurner commented on GitHub (Mar 3, 2019):

(I haven't looked at the code yet.) Is the rendered markdown HTML stored in the database or rendered for every request?

@westurner commented on GitHub (Mar 3, 2019): (I haven't looked at the code yet.) Is the rendered markdown HTML stored in the database or rendered for every request?
Author
Owner

@meteorlxy commented on GitHub (Mar 3, 2019):

I haven't looked at the code yet

Me neither 😅 In fact, I'm not familiar with this project

@meteorlxy commented on GitHub (Mar 3, 2019): > I haven't looked at the code yet Me neither 😅 In fact, I'm not familiar with this project
Author
Owner
@westurner commented on GitHub (Mar 3, 2019): I took a quick look for my first time: https://github.com/go-gitea/gitea/blob/master/models/issue.go - `RenderedContent` https://github.com/go-gitea/gitea/blob/master/routers/api/v1/api.go https://github.com/go-gitea/gitea/blob/master/routers/api/v1/repo/issue.go https://github.com/go-gitea/gitea/blob/master/routers/api/v1/misc/markdown.go
Author
Owner

@westurner commented on GitHub (Mar 3, 2019):

(t activates the GitHub file finder)

@westurner commented on GitHub (Mar 3, 2019): (`t` activates the GitHub file finder)
Author
Owner

@lunny commented on GitHub (Sep 3, 2020):

So I think this could be closed?

@lunny commented on GitHub (Sep 3, 2020): So I think this could be closed?
Author
Owner

@westurner commented on GitHub (Sep 3, 2020):

Where is and when was this feature implemented?

@westurner commented on GitHub (Sep 3, 2020): Where is and when was this feature implemented?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2945