feat(ngdocs): support for HTML table generation from docs code

This commit is contained in:
Matias Niemelä 2013-04-29 15:20:10 -04:00 committed by Igor Minar
parent 400f9360bb
commit b3a62b2e19
6 changed files with 19 additions and 1311 deletions

View file

@ -2,7 +2,7 @@
* All parsing/transformation code goes here. All code here should be sync to ease testing.
*/
var Showdown = require('../../lib/showdown').Showdown;
var Showdown = require('showdown');
var DOM = require('./dom.js').DOM;
var htmlEscape = require('./dom.js').htmlEscape;
var Example = require('./example.js').Example;
@ -216,7 +216,7 @@ Doc.prototype = {
});
});
text = parts.join('');
text = new Showdown.converter().makeHtml(text);
text = new Showdown.converter({ extensions : ['table'] }).makeHtml(text);
text = text.replace(/(?:<p>)?(REPLACEME\d+)(?:<\/p>)?/g, function(_, id) {
return placeholderMap[id];
});

View file

@ -1,7 +0,0 @@
var fs = require('fs');
var vm = require('vm');
var filename = __dirname + '/showdown-0.9.js';
var src = fs.readFileSync(filename);
var Showdown = vm.runInThisContext(src + '\nShowdown;', filename);
exports.Showdown = Showdown;

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,8 @@
"qq": "0.3.5",
"shelljs": "0.1.2",
"karma": "0.8.4",
"yaml-js": "0.0.5"
"yaml-js": "0.0.5",
"showdown": "0.3.1"
},
"licenses": [
{

View file

@ -143,6 +143,14 @@ directive.tabbable = function() {
};
};
directive.table = function() {
return {
restrict: 'E',
link: function(scope, element, attrs) {
element[0].className = 'table table-bordered table-striped code-table';
}
};
};
directive.tabPane = function() {
return {

View file

@ -15,11 +15,13 @@
*
* Below is a more detailed breakdown of the supported callback events provided by pre-exisitng ng directives:
*
* * {@link ng.directive:ngRepeat#animations ngRepeat} enter, leave and move
* * {@link ng.directive:ngView#animations ngView} enter and leave
* * {@link ng.directive:ngInclude#animations ngInclude} enter and leave
* * {@link ng.directive:ngSwitch#animations ngSwitch} enter and leave
* * {@link ng.directive:ngShow#animations ngShow & ngHide} - show and hide respectively
* | Directive | Supported Animations |
* |========================================================== |====================================================|
* | {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave and move |
* | {@link ng.directive:ngView#animations ngView} | enter and leave |
* | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave |
* | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave |
* | {@link ng.directive:ngShow#animations ngShow & ngHide} | show and hide |
*
* You can find out more information about animations upon visiting each directive page.
*