logo

Codemeup

Endpoints

render_lines

GET

https://codemeup.vercel.app/api/{username}/{repository}/render_lines

This endpoint allows to render code directly from Github.
The username path parameter is used to authenticate to the Codemeup backend and is the same as the Github username.
The repository path parameter is used to identify the repository from which the code is taken. It is possible to specify also repository owned by an organization using the following format: {organization}@{repository}.
It is important to remember that the specified organization must be owned by the provided user!

Query parameters

IDDescriptionValues

path [Required]

The relative path of the file to render in the specified repo Any string path format. This path can be copied from the top bar while navigating a repository in Github

branch

The branch name to consider Any existing branch. Do not provide this parameter to use the default branch

fragment

The fragment to render (portion of lines) A string in format <rowFrom>-<rowTo>. Do not provide this parameter to render the whole file

render_source

POST

https://codemeup.vercel.app/api/{username}/render_source

This endpoint allows to render code by passing the source directly into the body of the request.
The username path parameter is used to authenticate to the Codemeup backend and is the same as the Github username.

Body parameters

IDDescriptionValues

src

The source codeAny source code in string format

lang

The language of the codeThe language is used to format and highlight the code. Available languages are

Styling options

Styling options can be appended to any endpoint and are responsible to override the aspect of the final render.

IDDescriptionValues

theme

Select the theme of the code highlighter All themes supported by Shiki

border-radius

The border radius of the backgroundAny number expressed in pixels

padding

The padding of the text from the borderAny number expressed in pixels

bg

Override the color of the background Any color in hex format.

The character # must be escaped as %23.

Use transparent to remove the background.

font-family

Set the font family Any font family supported by Google. All families available here

font-size

Set the font size[small, medium, large]

font-weight

Set the font weight [100, 200, 300, 400, 500, 600, 700, 800, 900]
Available weights might depend on the font used

font-line-height

Set the height of the lines of the fontAny number expressed in pixels

Response formatting

It is possible to use the endpoints and obtain a formatted response instead of a plain xml svg element.
If the format query parameter is not provided, the response will be a image/svg+xml.

raw

Raw data returns the plain image/svg+xml element.

structured

Structured data returns a text/json object with the following structure:

IDDescription

request

The incoming request structured in an object

formatted

Whether the code has been formatted

codeHtml

The self-contained styled code in html format

html

The complete image/svg+xml html code