diff --git a/markdown.js b/markdown.js
index 3359016..73a9b51 100644
--- a/markdown.js
+++ b/markdown.js
@@ -56,6 +56,14 @@ class Symbol {
static create(lineFeed, assetDirectory) {
throw new Error("Not implemented");
}
+ /**
+ *
+ * @param {string} assetDirectory
+ * @returns {void}
+ */
+ process(assetDirectory) {
+ throw new Error("Not Implemented");
+ }
render() {
throw new Error("Not implemented");
}
@@ -94,6 +102,15 @@ class Heading extends Symbol {
return instance;
}
+ /**
+ *
+ * @param {string} assetDirectory
+ * @returns {void}
+ */
+ process(assetDirectory) {
+ return;
+ }
+
render() {
return `
${this.lines.join("")}
`; } @@ -173,6 +211,15 @@ class UnorderedListItem extends Symbol { return instance; } + /** + * + * @param {string} assetDirectory + * @returns {void} + */ + process(assetDirectory) { + return; + } + render() { return `${this.text}`;
}
@@ -522,12 +626,22 @@ class MultiLineCode extends Symbol {
instance.text = lines.join("\n");
return instance;
}
+
+ /**
+ *
+ * @param {string} assetDirectory
+ * @returns {void}
+ */
+ process(assetDirectory) {
+ return;
+ }
+
render() {
return `${this.text}`;
}
}
-class CatchAll extends Symbol {
+class Text extends Symbol {
/**
* @type {string}
*/
@@ -547,10 +661,20 @@ class CatchAll extends Symbol {
* @returns {Symbol}
*/
static create(lineFeed) {
- const instance = new CatchAll();
+ const instance = new Text();
instance.text = lineFeed.claim();
return instance;
}
+
+ /**
+ *
+ * @param {string} assetDirectory
+ * @returns {void}
+ */
+ process(assetDirectory) {
+ return;
+ }
+
render() {
return `${this.text}`;
}
@@ -638,7 +762,7 @@ const Factories = [
Link,
MultiLineCode,
SingleLineCode,
- CatchAll,
+ Text,
];
/**
@@ -649,6 +773,13 @@ const Factories = [
*/
export const toHtml = (markdown, assetDirectory) => {
const symbols = toSymbols(markdown, assetDirectory);
+
+ let lastIterationsSymbolsAsJson = JSON.stringify(symbols);
+ do {
+ console.log("starting processing");
+ symbols.forEach((s) => s.process(assetDirectory));
+ } while (JSON.stringify(symbols) !== lastIterationsSymbolsAsJson);
+
const html = symbols.map((s) => s.render()).join("");
return `