From 79ade251c3a5b24dd2797947983dbac44ecfc4c0 Mon Sep 17 00:00:00 2001 From: Lino Le Van <11367844+lino-levan@users.noreply.github.com> Date: Wed, 8 Mar 2023 00:48:06 -0800 Subject: [PATCH] chore: allow example script to be run via url (#45) --- example/content.md | 15 ++++++--------- example/main.ts | 3 ++- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/example/content.md b/example/content.md index 5d20760..c2e28a0 100644 --- a/example/content.md +++ b/example/content.md @@ -61,15 +61,12 @@ When $a \ne 0$, there are two solutions to $(ax^2 + bx + c = 0)$ and they are $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$ -You can even typeset individual letters or whole sentences inline just like $x$ or $Quadratic \; formula$. You can also use math blocks to typeset whole equations with $\LaTeX$: - -$$ -\begin{aligned} -\dot{x} & = \sigma(y-x) \\ -\dot{y} & = \rho x - y - xz \\ -\dot{z} & = -\beta z + xy -\end{aligned} -$$ +You can even typeset individual letters or whole sentences inline just like $x$ +or $Quadratic \; formula$. You can also use math blocks to typeset whole +equations with $\LaTeX$: + +$$ \begin{aligned} \dot{x} & = \sigma(y-x) \\ \dot{y} & = \rho x - y - xz \\ +\dot{z} & = -\beta z + xy \end{aligned} $$ # Deno diff --git a/example/main.ts b/example/main.ts index 593f4a7..26fdd7a 100644 --- a/example/main.ts +++ b/example/main.ts @@ -14,7 +14,8 @@ const CONTENT_PATH = new URL("./content.md", import.meta.url); async function handler(_req: Request): Promise { try { - const markdown = await Deno.readTextFile(CONTENT_PATH); + const markdown = await (await fetch(CONTENT_PATH)).text(); + const body = render(markdown, { allowIframes: true, allowMath: true,