Diese Version von GitHub Enterprise Server wurde eingestellt am 2024-07-09. Es wird keine Patch-Freigabe vorgenommen, auch nicht für kritische Sicherheitsprobleme. Für bessere Leistung, verbesserte Sicherheit und neue Features aktualisiere auf die neueste Version von GitHub Enterprise Server. Wende dich an den GitHub Enterprise-Support, um Hilfe zum Upgrade zu erhalten.
REST-API-Endpunkte für Markdown
Verwende die REST-API, um ein Markdowndokument als HTML-Seite oder unformatierten Text zu rendern.
Render a Markdown document
Parameter für „Render a Markdown document“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
text string ErforderlichThe Markdown text to render in HTML. |
mode string The rendering mode. Standard: Kann eine der Folgenden sein: |
context string The repository context to use when creating references in |
HTTP-Antwortstatuscodes für „Render a Markdown document“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
304 | Not modified |
Codebeispiele für „Render a Markdown document“
Anforderungsbeispiel
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/markdown \
-d '{"text":"Hello **world**"}'
Example response
Status: 200
"<p>Hello <strong>world</strong></p>"
Render a Markdown document in raw mode
You must send Markdown as plain text (using a Content-Type
header of text/plain
or text/x-markdown
) to this endpoint, rather than using JSON format. In raw mode, GitHub Flavored Markdown is not supported and Markdown will be rendered in plain format like a README.md file. Markdown content must be 400 KB or less.
HTTP-Antwortstatuscodes für „Render a Markdown document in raw mode“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
304 | Not modified |
Codebeispiele für „Render a Markdown document in raw mode“
Beispiele für Anforderungen
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/markdown/raw \
-d '{"text":"Hello **world**"}'
Example response
Status: 200
"<p>Hello <strong>world</strong></p>"