diff --git a/build.js b/build.js index 11afbc6..3261654 100644 --- a/build.js +++ b/build.js @@ -49,7 +49,6 @@ manifest.forEach((m) => { if (!fs.existsSync(m.assetDirectoryPath)) return; const assetsList = fs.readdirSync(m.assetDirectoryPath); - console.log(assetsList); assetsList.forEach((assetName) => fs.cpSync( `${m.assetDirectoryPath}/${assetName}`, diff --git a/markdown.js b/markdown.js index 0ef3d26..3359016 100644 --- a/markdown.js +++ b/markdown.js @@ -99,6 +99,49 @@ class Heading extends Symbol { } } +class Paragraph extends Symbol { + /** + * @type {string[]} + */ + lines = []; + /** + * + * @param {string} line + * @returns {boolean} + */ + static canParse(line) { + return line === ""; + } + + /** + * + * @param {LineFeed} lineFeed + * @returns {Symbol} + */ + static create(lineFeed) { + const instance = new Paragraph(); + lineFeed.claim(); + + const lines = []; + let endOfParagraph = false; + while (!endOfParagraph && !lineFeed.isEmpty()) { + const line = lineFeed.peek(); + if (line === "") { + endOfParagraph = true; + continue; + } + lines.push(lineFeed.claim()); + } + + instance.lines = lines; + return instance; + } + + render() { + return `
${this.lines.join("")}
`; + } +} + class UnorderedListItem extends Symbol { /** * @type {string} @@ -585,6 +628,7 @@ const getAmountOfTokenInBeginningOfFile = (token, string) => { * @type {Symbol[]} */ const Factories = [ + Paragraph, Heading, UnorderedListItem, OrderedListItem,