block.js 582 B

123456789101112131415161718192021222324
  1. var rules = require('../rules/block').tables;
  2. var engine = require('./engine');
  3. // List of all the regexes we want to run
  4. var ruleTypes = [
  5. 'newline', 'code', 'fences', 'footnote', 'heading',
  6. 'nptable', 'lheading', 'hr', 'blockquote', 'list',
  7. 'html', 'def', 'table', 'paragraph', 'text',
  8. ];
  9. // Mapping if rule type is different from token type
  10. var ruleMap = {
  11. 'nptable': 'table',
  12. 'lheading': 'heading',
  13. 'newline': 'space',
  14. 'fences': 'code',
  15. };
  16. function annotate(src) {
  17. return engine(src, rules, ruleTypes, ruleMap);
  18. }
  19. module.exports = annotate;