Previewing
Throughout OpenProject user input for many properties can be formatted using Markdown. Using the appropriate rendering endpoint it is possible to render custom formatted inputs into HTML and thus receive a preview of the rendered text.
The request to a rendering endpoint must always have a MIME-Type of text/plain
.
The request body is the actual string that shall be rendered as HTML string.
Markdown
- Parameters
- context
string
(optional) Example: /api/v3/work_packages/42API-Link to the context in which the rendering occurs, for example a specific work package.
If left out only context-agnostic rendering takes place. Please note that OpenProject features markdown-extensions on top of the extensions GitHub Flavored Markdown (gfm) already provides that can only work given a context (e.g. display attached images).
Supported contexts:
/api/v3/work_packages/{id}
- an existing work package
- RequestToggle details
Headers
Content-Type: text/plain
Body
Hello world! "This":http://example.com **is** markdown!
- Response
200
Toggle details Headers
Content-Type: text/html
Body
<p>Hello world! <a href="http://example.com">This</a> <strong>is</strong> markdown!</p>
- Response
400
Toggle details Returned if the context passed by the client is not valid (e.g. unknown).
Note that this response will also occur when the requesting user is not allowed to see the context resource (e.g. limited work package visibility).
Headers
Content-Type: application/json
Body
{ "_type": "Error", "errorIdentifier": "urn:openproject-org:api:v3:errors:InvalidRenderContext", "message": "Could not render markdown string in the given context." }
- Response
415
Toggle details Returned if the Content-Type indicated in the request is not
text/plain
.Headers
Content-Type: application/json
Body
{ "_type": "Error", "errorIdentifier": "urn:openproject-org:api:v3:errors:TypeNotSupported", "message": "Expected Content-Type to be 'text/plain' but got 'application/json'." }
Plain Text
- RequestToggle details
Headers
Content-Type: text/plain
Body
Hello world! This *is* plain text!
- Response
200
Toggle details Headers
Content-Type: text/html
Body
<p>Hello world! This *is* plain text!</p>
- Response
415
Toggle details Returned if the Content-Type indicated in the request is not
text/plain
.Headers
Content-Type: application/json
Body
{ "_type": "Error", "errorIdentifier": "urn:openproject-org:api:v3:errors:TypeNotSupported", "message": "Expected Content-Type to be 'text/plain' but got 'application/json'." }
Help and feedback
If you did not find what you were looking for
If you need help from the community or want to support others
If you are eligible for professional support and have more questions
REQUEST SUPPORT
If you find an easily fixable error or need for improvement in the documentation for the stable release
If you would like to suggest bigger updates or improvements to this documentation
If you want to contribute to translate this documentation to another language
If there's something you don't like or understand about this feature
If you want to propose a new feature that OpenProject does not offer yet
To further help OpenProject to shape and test new features
To view OpenProject premium features and pricing
If you want to try all premium features in the OpenProject Cloud Edition 14 days for free
If you want to try all premium features in your on premise Community installation 14 days for free