diff --git a/README.md b/README.md index a985a5a..555fc8f 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,10 @@ A writeup of everything I currently know about quantum mechanics, especially the schrodinger equation. +## Building + +Install all necessary packages: +```npm i``` + +Build the article files: +```npm run build``` diff --git a/README.md b/README.md index a985a5a..555fc8f 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,10 @@ A writeup of everything I currently know about quantum mechanics, especially the schrodinger equation. +## Building + +Install all necessary packages: +```npm i``` + +Build the article files: +```npm run build``` diff --git a/src/article/main.md b/src/article/main.md index 9058c91..2adcde5 100644 --- a/src/article/main.md +++ b/src/article/main.md @@ -3,3 +3,7 @@ ## Mathematical prerequisites To understand this article, you will need a thorough understanding of complex numbers. + +I will also use Euler's formula $e^{ix} = cos(x) + i*sin(x)$ + +$$e^{ix} = cos(x) + i*sin(x)$$ diff --git a/README.md b/README.md index a985a5a..555fc8f 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,10 @@ A writeup of everything I currently know about quantum mechanics, especially the schrodinger equation. +## Building + +Install all necessary packages: +```npm i``` + +Build the article files: +```npm run build``` diff --git a/src/article/main.md b/src/article/main.md index 9058c91..2adcde5 100644 --- a/src/article/main.md +++ b/src/article/main.md @@ -3,3 +3,7 @@ ## Mathematical prerequisites To understand this article, you will need a thorough understanding of complex numbers. + +I will also use Euler's formula $e^{ix} = cos(x) + i*sin(x)$ + +$$e^{ix} = cos(x) + i*sin(x)$$ diff --git a/src/build.js b/src/build.js index 4acee5c..04ea6a3 100644 --- a/src/build.js +++ b/src/build.js @@ -20,21 +20,48 @@ [fileName.replace(".md", "")]: fs.readFileSync(`${articleFolder}/${fileName}`, 'utf8').split("\n") }), {}); +const applyBigMathMode = line => line.replace(/\$\$/, bigMathMode ? "\\]" : "\\[") +const applyMathMode = line => line.replace(/\$/, mathMode ? "\\)" : "\\(") + +function processMathModes(line) { + var bigMathModeReplace = applyBigMathMode(line); + while (bigMathModeReplace != line) { + line = bigMathModeReplace; + bigMathMode = !bigMathMode; + bigMathModeReplace = applyBigMathMode(line); + } + + var mathModeReplace = applyMathMode(line) + while (mathModeReplace != line) { + line = mathModeReplace; + mathMode = !mathMode; + mathModeReplace = applyMathMode(line); + } + return line +} + for (const [name, data] of Object.entries(articleEntries)) { + var mathMode = false; + var bigMathMode = false; data.forEach((line, index) => { + const noSpaces = line.replace(" ", ""); + if (noSpaces == "") { + line = "
";
+ }
for (var i = 1; i < 5; i++) {
const headerStart = `${"#".repeat(i)} `
if (line.startsWith(headerStart)) {
line = `
";
+ }
for (var i = 1; i < 5; i++) {
const headerStart = `${"#".repeat(i)} `
if (line.startsWith(headerStart)) {
line = `
+ +