From b6bc6c2ddf1ae1523ec7e4cb92db209cd6501181 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 29 Apr 2011 14:43:43 -0700 Subject: fix syntax highlighting on the javascript --- docs/spec/ngdocSpec.js | 8 ++++---- docs/src/ngdoc.js | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js index 46b05aef..68d3700f 100644 --- a/docs/spec/ngdocSpec.js +++ b/docs/spec/ngdocSpec.js @@ -307,10 +307,10 @@ describe('ngdoc', function(){ describe('@description', function(){ it('should support pre blocks', function(){ - var doc = new Doc("@description
abc
"); + var doc = new Doc("@description
abc
"); doc.parse(); expect(doc.description). - toBe('
abc
'); + toBe('
<b>abc</b>
'); }); it('should support multiple pre blocks', function() { @@ -318,10 +318,10 @@ describe('ngdoc', function(){ doc.parse(); expect(doc.description). toBe('

foo

' + - '
abc
' + + '
abc
' + '

bah

\n\n' + '

foo

' + - '
cba
'); + '
cba
'); }); diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 875b24df..57202809 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -70,7 +70,12 @@ Doc.prototype = { parts.forEach(function(text, i){ if (text.match(/^
/)) {
         text = text.replace(/^
([\s\S]*)<\/pre>/mi, function(_, content){
-          return '
' +
+          var clazz = 'brush: js;'
+          if (content.match(/\<\w/)) {
+            // we are HTML
+            clazz += ' html-script: true;';
+          }
+          return '
' +
                   content.replace(//g, '>') +
                  '
'; }); -- cgit v1.2.3