我不知道什么地方出错了,还是还不支持,但我希望看到如下代码块:
var示例= 3;
在需要突出显示的文件中。
如何修复/添加此功能?
发布于 2014-12-27 14:37:56
解决办法:
标记模块用于grunt-ngdocs (grunt-ngdocs\node_modules\marked\lib)。由于grunt-ngdocs使用的是角引导-美化( BTW使用google-code-prettify),因此只需稍微调整标记就可以生成<pre class="prettyprint linenums">...</pre>而不是<pre>...</pre>。
因此,在Renderer.prototype.code函数(在我的版本中是第757行),返回语句可以更改如下:
return '<pre class="prettyprint linenums"><code>' ...return '<pre class="prettyprint linenums"><code class="' ...更清洁的解决方案:
ngDocs似乎用<pre class="prettyprint linenums">...</pre>替换了所有<pre>..</pre>块(第266行,v0.2.6)。因此,我们可以直接在文档中使用```块,而不是使用标记式的```代码块。
发布于 2014-12-25 02:18:47
我用高光和jQuery livequery插件解决了这个问题
我在Gruntfile.js中的ngdocs部分现在如下所示:
options: {
html5Mode: false,
scripts: [
'bower_components/jquery/dist/jquery.js',
'js/jquery.livequery.min.js',
'angular.js',
'js/helpers/ngdocs.js',
'bower_components/highlightjs/highlight.pack.js'
],
styles: [
'bower_components/highlightjs/styles/atelier-forest.dark.css'
]我的js/helpers/ngdocs.js看起来是这样的:
'use strict';
/* global $, hljs */
$(function () {
$('pre code').livequery(
function() {
hljs.highlightBlock(this);
});
});https://stackoverflow.com/questions/27272960
复制相似问题