apiaryio / api-blueprint

API Blueprint
https://apiblueprint.org
MIT License
8.64k stars 2.14k forks source link

Syntax Highlighting on Apiary.io #315

Closed Perni1984 closed 5 years ago

Perni1984 commented 8 years ago

I would like to put some additional code examples (PHP Code of how to use our API) in the API Blueprint Specification on Apiary.io.

Standard code highlighting like that works

my code

PHP code syntax highlighting doesn't work, it looks like standard code highlighting:

```php
<?
$private_key = file_get_contents('id_rsa');
$client_id   = 'https://www.my-client-app.com';
$user_id     = 'youremail@yourserver.com';
$grant_type  = 'urn:ietf:params:oauth:grant-type:jwt-bearer';

$jwt = generate
Perni1984 commented 8 years ago

I read that e.g. Atlassian is using CodeMirror for their syntax highlighting. Eventually this would also be possible for apiary.io (it has a MIT License)

Perni1984 commented 8 years ago

another idea would be to use highlight.js, which supports PHP and HTTP syntax highlighting and a bunch of other languages.

yardensachs commented 8 years ago

Any news on this?

talkoren commented 7 years ago

+1

ryanwinchester commented 6 years ago

This would be really great for us, too.

Github does this the best and supports the most languages, as far as I can tell (I am especially happy when elixir-lang is properly highlighted).

https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting

kylef commented 5 years ago

Hi, please check out the announcement about our brand new API Documentation https://blog.apiary.io/ApiaryUI. We've introduced syntax highlighting, it doesn't yet support all languages (you can see a list of supported languages in the announcement).

Here's how it looks:

screenshot 2019-01-17 at 10 09 22
import requests

requests.get('https://api.example.com')

If you have any further feature requests or bug reports that are specific to Apiary rendered documentation please reach out to Apiary support. This repository and issue tracker is tracking the API Blueprint specification. If you have some requests for supported languages be sure to reach out to Apiary support so that we can priotitise them accordingly.