From 79a525aa64b98b541dd7537afc58ff42580abb52 Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Tue, 19 May 2015 19:01:01 -0400 Subject: [PATCH] docs: syntax highlight from markdown --- docs/authorization.md | 4 +- .../authorization/authorization.html | 2 +- .../components/subpage/subpage-directive.js | 61 ++++++++++++++++++- docs/site/css/main.css | 5 ++ 4 files changed, 68 insertions(+), 4 deletions(-) diff --git a/docs/authorization.md b/docs/authorization.md index bbb93da1505..c8fae3c6f04 100644 --- a/docs/authorization.md +++ b/docs/authorization.md @@ -4,7 +4,7 @@ With `gcloud-node` it's incredibly easy to get authorized and start using Google If you are running this client on Google Compute Engine, we handle authorization for you with no configuration. You just need to make sure that when you [set up the GCE instance][gce-how-to], you add the correct scopes for the APIs you want to access. -``` js +```js hljs-class var config = { projectId: 'grape-spaceship-123' }; @@ -26,7 +26,7 @@ If you are not running this client on Google Compute Engine, you need a Google D * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authorize your requests. * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. -``` js +``` js hljs-class var config = { projectId: 'grape-spaceship-123', keyFilename: '/path/to/keyfile.json' diff --git a/docs/site/components/authorization/authorization.html b/docs/site/components/authorization/authorization.html index a494ccf1c77..2221dbe3f8f 100644 --- a/docs/site/components/authorization/authorization.html +++ b/docs/site/components/authorization/authorization.html @@ -15,5 +15,5 @@
- +
diff --git a/docs/site/components/subpage/subpage-directive.js b/docs/site/components/subpage/subpage-directive.js index 9bbff6641f8..6001a9fa51c 100644 --- a/docs/site/components/subpage/subpage-directive.js +++ b/docs/site/components/subpage/subpage-directive.js @@ -1,5 +1,6 @@ angular - .module('gcloud.subpage', ['gcloud.header']) + .module('gcloud.subpage', ['gcloud.header', 'hljs']) + .directive('subpage', function($rootScope, $location, $http, $parse, getLinks, versions) { 'use strict'; @@ -34,4 +35,62 @@ angular } } }; + }) + + // A special class used in our MD files to tell the front end to syntax + // highlight the code blocks. + .directive('hljsClass', function() { + 'use strict'; + + return { + // Concept borrowed from: + // http://www.bennadel.com/blog/2748-compiling-transcluded-content-in-angularjs-directives.htm + // + //
+ // var hi = 'there';