Adding initial math support

This commit is contained in:
Shan Carter
2017-04-13 16:49:00 -07:00
parent c24a1d0485
commit b3efa2526d
9 changed files with 9131 additions and 11 deletions
+19
View File
@@ -0,0 +1,19 @@
import katex from "katex";
const html = `
<style>
dt-math[block] {
display: block;
}
</style>
`;
export default function(dom, data) {
let equationElements = [].slice.call(dom.querySelectorAll("dt-math"));
equationElements.forEach(el => {
let content = el.textContent;
console.log(content)
let displayMode = el.hasAttribute("block") ? true : false;
el.innerHTML = html + katex.renderToString(content, {displayMode: displayMode});
});
}
View File
+3
View File
@@ -26,6 +26,7 @@ dt-article > h4,
dt-article > figure,
dt-article > ul,
dt-article > dt-byline,
dt-article > dt-math,
dt-article > dt-code,
dt-article section > div,
dt-article section > p,
@@ -59,6 +60,7 @@ dt-article section > dt-code {
dt-article > figure,
dt-article > ul,
dt-article > dt-byline,
dt-article > dt-math,
dt-article > dt-code,
dt-article section > div,
dt-article section > p,
@@ -85,6 +87,7 @@ dt-article section > dt-code {
dt-article > figure,
dt-article > ul,
dt-article > dt-byline,
dt-article > dt-math,
dt-article > dt-code,
dt-article section > div,
dt-article section > p,