我正在使用gulp-markdown包将markdown文件呈现为HTML部分。 (它使用npm marked包进行实际渲染。)除了我的代码块之外,一切都很好!如何获得正确格式化的HTML?
这是我的意思:
var gulp = require('gulp');
var markdown = require('gulp-markdown');
markdown.marked.setOptions({
renderer: new markdown.marked.Renderer(),
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: true,
smartLists: true,
smartypants: false
});
// turn md files into html partials
gulp.task('blogPosts', function () {
return gulp.src('src/blog/blogOne.md')
.pipe(markdown())
.pipe(gulp.dest('src/partials'));
});
这是我的降价:
```JavaScript
app.controller('DisplayController', ['$scope', 'ClogsService', function($scope, ClogsService){
$scope.clogs = [];
$scope.getClogs = function() {
ClogService.getClogs()
.then(function(response){
ClogsService.clogs = response.data;
$scope.clogs = ClogsService.clogs;
});
};
})
```
这是输出HTML:
<pre><code>app.controller('DisplayController', ['$scope', 'ClogsService', function($scope, ClogsService){
$scope.clogs = [];
$scope.getClogs = function() {
ClogService.getClogs()
.then(function(response){
ClogsService.clogs = response.data;
$scope.clogs = ClogsService.clogs;
});
};
})
</code></pre>
如何使用语法高亮显示正确呈现代码块的页面?