From bf3abc83ce0dbe8e5600a05598350be7a04c0d32 Mon Sep 17 00:00:00 2001 From: Danny Miller Date: Fri, 30 Oct 2015 10:55:21 -0400 Subject: [PATCH 1/2] Change highlight application to use angular.each --- lib/resources/js/directives/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/resources/js/directives/index.js b/lib/resources/js/directives/index.js index 298047f..bd05f69 100755 --- a/lib/resources/js/directives/index.js +++ b/lib/resources/js/directives/index.js @@ -97,7 +97,9 @@ angular.module('docular.directives', []) compiled = $compile( sourceContent )( $scope ); compiled.find('code').text($scope.source || script); $element.empty().append(compiled); - hljs.highlightBlock(compiled.find('pre')[0]); + angular.element('pre code').each(function(i, block) { + hljs.highlightBlock(block); + }); }) } } From c123bed17442e804992468befe44c98fd77d6469 Mon Sep 17 00:00:00 2001 From: Danny Miller Date: Fri, 30 Oct 2015 11:02:51 -0400 Subject: [PATCH 2/2] All that was needed was an update to the selector in the already used code --- lib/resources/js/directives/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/resources/js/directives/index.js b/lib/resources/js/directives/index.js index bd05f69..92917c1 100755 --- a/lib/resources/js/directives/index.js +++ b/lib/resources/js/directives/index.js @@ -97,9 +97,7 @@ angular.module('docular.directives', []) compiled = $compile( sourceContent )( $scope ); compiled.find('code').text($scope.source || script); $element.empty().append(compiled); - angular.element('pre code').each(function(i, block) { - hljs.highlightBlock(block); - }); + hljs.highlightBlock(compiled.find('pre code')[0]); }) } }