|
|
|
@ -1,6 +1,18 @@ |
|
|
|
|
"use strict"; |
|
|
|
|
|
|
|
|
|
const {lexer} = require("marked"); |
|
|
|
|
const {Lexer, marked} = require("marked"); |
|
|
|
|
const util = require("util"); |
|
|
|
|
|
|
|
|
|
const tokenizer = { |
|
|
|
|
list : (source) => { |
|
|
|
|
console.log(source); |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
marked.use({tokenizer}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Slide { |
|
|
|
|
title; |
|
|
|
@ -17,7 +29,8 @@ class Slide { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const tokenize = string => { |
|
|
|
|
return lexer(string); |
|
|
|
|
//console.log(util.inspect(marked.Lexer.rules.block.listItemStart, true, null, true));
|
|
|
|
|
return new Lexer({gfm : true}).lex(string); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const injectTitle = (deck, meta) => { |
|
|
|
@ -71,7 +84,7 @@ const parser = string => { |
|
|
|
|
let metaData = null; |
|
|
|
|
|
|
|
|
|
for (const token of tokenStream) { |
|
|
|
|
if ( token.type === "space" || (token.type === "heading" && token.depth === 1) || token.type === "html") { |
|
|
|
|
if (token.type === "space" || (token.type === "heading" && token.depth === 1) || token.type === "html") { |
|
|
|
|
if (currentSlide.content.length > 0) { |
|
|
|
|
slideDeck.push(currentSlide); |
|
|
|
|
currentSlide = new Slide(); |
|
|
|
|