diff --git a/markdown.js b/markdown.js
index e9e72a2..45af79f 100644
--- a/markdown.js
+++ b/markdown.js
@@ -90,6 +90,70 @@ class Heading extends Symbol {
}
}
+class Italic extends Symbol {
+ /**
+ * @type {string}
+ */
+ text = "";
+ /**
+ *
+ * @param {string} line
+ * @returns {boolean}
+ */
+ static canParse(line) {
+ const trimmedLine = line.trim();
+ return trimmedLine.startsWith("_") && trimmedLine.endsWith("_");
+ }
+
+ /**
+ *
+ * @param {LineFeed} lineFeed
+ * @returns {Symbol}
+ */
+ static create(lineFeed) {
+ const instance = new Italic();
+ const line = lineFeed.claim().trim();
+ const lineWithoutUnderscores = line.slice(1, line.length - 1);
+ instance.text = lineWithoutUnderscores;
+ return instance;
+ }
+ render() {
+ return `${this.text}`;
+ }
+}
+
+class Bold extends Symbol {
+ /**
+ * @type {string}
+ */
+ text = "";
+ /**
+ *
+ * @param {string} line
+ * @returns {boolean}
+ */
+ static canParse(line) {
+ const trimmedLine = line.trim();
+ return trimmedLine.startsWith("**") && trimmedLine.endsWith("**");
+ }
+
+ /**
+ *
+ * @param {LineFeed} lineFeed
+ * @returns {Symbol}
+ */
+ static create(lineFeed) {
+ const instance = new Bold();
+ const line = lineFeed.claim().trim();
+ const lineWithoutUnderscores = line.slice(2, line.length - 2);
+ instance.text = lineWithoutUnderscores;
+ return instance;
+ }
+ render() {
+ return `${this.text}`;
+ }
+}
+
class CatchAll extends Symbol {
/**
* @type {string}
@@ -119,7 +183,7 @@ class CatchAll extends Symbol {
}
}
-const Factories = [Heading, CatchAll];
+const Factories = [Heading, Bold, Italic, CatchAll];
export const toHtml = (markdown) => {
const symbols = toSymbols(markdown);