Markdown
by Codi Bezouka-Smith
HTML
<div id="app">
<div id="input">
input:
<p></p>
</div>
<div id="output">
output:
<p></p>
</div>
</div>
CSS
#app #inp {}
#app #out {
font-weight: bold;
}
JavaScript
const data = "**a portion of bold text**, and *italic text*. > here is a blockquote";
const inp = document.querySelector("#input p");
inp.textContent = data;
const out = document.querySelector("#output p");
const string_between_strings = (startStr, endStr, str) => {
const pos = str.indexOf(startStr) + startStr.length;
return str.substring(pos, str.indexOf(endStr, pos));
}
const bold_text = () => {
return string_between_strings("**", "**", data);
}
const res = bold_text();
console.log(res);