Skip to content

Commit ad8ec0f

Browse files
fry69bartlomiejuclaude
authored
docs: fix markdown docs (#3459)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent dd1ecf3 commit ad8ec0f

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

docs/latest/examples/markdown.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ First, let's install the [`@deno/gfm`](https://jsr.io/@deno/gfm) package that
1212
can transform markdown to html.
1313

1414
1. Run `deno install jsr:@deno/gfm`
15-
2. Create a markdown file like `content.md`:
15+
2. Create a markdown file like `content/example.md`:
1616

17-
```md path/to/content.md
17+
```md content/example.md
1818
## some heading
1919

2020
and some interesting text here
@@ -24,25 +24,30 @@ and some interesting text here
2424

2525
3. Add a route that renders that file
2626

27-
```tsx main.ts
27+
```tsx routes/markdown.tsx
28+
import { define } from "@/utils.ts";
2829
import { CSS, render as renderMarkdown } from "@deno/gfm";
2930

30-
const app = new App();
31-
32-
app.get("/", async (ctx) => {
33-
const content = await Deno.readTextFile("path/to/content.md");
31+
export default define.page(async () => {
32+
const content = await Deno.readTextFile("./content/example.md");
3433
const html = renderMarkdown(content);
3534

36-
return await ctx.render(
35+
return (
3736
<div>
3837
<h1>Here comes a markdown post:</h1>
38+
{/* deno-lint-ignore react-no-danger */}
3939
<style dangerouslySetInnerHTML={{ __html: CSS }} />
40+
{/* deno-lint-ignore react-no-danger */}
4041
<div dangerouslySetInnerHTML={{ __html: html }} />
41-
</div>,
42+
</div>
4243
);
4344
});
4445
```
4546

47+
For a more elaborate markdown system with Fresh, take a look at the
48+
[source code](https://github.com/denoland/fresh/tree/main/www) for this
49+
documentation website.
50+
4651
## Other libraries
4752

4853
There are several other popular libraries besides `@deno/gfm` that can be used

0 commit comments

Comments
 (0)