Skip to content
My Blog
Go back

What a code-heavy post looks like

Use this post to tweak the theme. Inline code looks like bun run dev, and code blocks are highlighted at build time by Shiki, with no JavaScript shipped to the reader.

Table of contents

Open Table of contents

Code blocks

AstroPaper adds file names, line highlights and diffs through Shiki transformers:

export function readingTime(markdown = "") {
  const words = markdown.trim().split(/\s+/).filter(Boolean).length; 
  return Math.max(1, Math.round(words / 220));
}src/utils/readingTime.ts
const posts = await getCollection("posts"); 
const posts = await getCollection("posts", ({ data }) => !data.draft); 

Callouts

Tip

Callouts use the Obsidian/GitHub syntax.

A table, because tech posts love tables

FormatTitleTypical lengthComments
Postyes800+ wordsyes
Noteno< 500 charsyes

Drafts and scheduled posts

Add draft: true to the frontmatter to keep a post unpublished. A pubDatetime in the future schedules it: it appears on the first build after that date.


Share this post:

Next Post
Hello, world