Namegarage

Syntax highlighting in the API docs

Dev blog#api#accessibility

In the API quickstart, you can now pick out the search string in a curl command or the price limit in a TypeScript example by color. The same colors appear in the protocol guides and in the JSON schemas in the static API reference.

The site builds each example with the engineering blog’s Pygments highlighter and displays it in Geist Mono. The colors work with JavaScript turned off.

A $ marks the start of a shell command. In the three-line search example, the > signs show where that same command continues. Select the example or use Copy to get the command with its original spacing and line breaks. On a phone, the Copy button sits above the command so you can read the whole line. The prompt signs stay on the page. Read as Markdown gives you the guide with its language-tagged code fences.

Add as preferred source
Hacker News X LinkedIn Email

Using this button loads Google’s service and allows its usage measurement. Privacy policy.

Get new blog posts by email

Comments

Comments are reviewed before publication. The Author badge marks replies from the author.

Read approved comments on the discussion page.

    Open the discussion page

    Leave a comment

    Your account name, sign-in provider, and comment become public after review. Your email stays private. See the blog comments privacy notice and Privacy Policy.

    Sign in to leave a comment.