1. Create typeset.css
Copy the stylesheet into public/typeset.css, then import it in public/input.css:
@import "tailwindcss"; @import "./typeset.css";
2. Add the fonts
Link the fonts in your root layout:
<!-- app/layout.ts, in <head> --> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@100..900&family=Geist+Mono:wght@100..900&display=swap">
Then name them in your CSS file:
/* public/input.css */
:root {
--font-geist: 'Geist', sans-serif;
--font-geist-mono: 'Geist Mono', monospace;
}
Save each font's latin variable woff2 in public/fonts/, then declare it in your CSS file:
/* public/input.css */
@font-face {
font-family: 'Geist';
font-style: normal;
font-weight: 100 900;
font-display: swap;
src: url('/fonts/geist.woff2') format('woff2');
}
@font-face {
font-family: 'Geist Mono';
font-style: normal;
font-weight: 100 900;
font-display: swap;
src: url('/fonts/geist-mono.woff2') format('woff2');
}
:root {
--font-geist: 'Geist', sans-serif;
--font-geist-mono: 'Geist Mono', monospace;
}
3. Create your custom typeset
/* public/input.css */
@import "tailwindcss";
@import "./typeset.css";
.typeset-notes {
--typeset-font-body: var(--font-geist);
--typeset-font-heading: var(--font-geist);
--typeset-font-mono: var(--font-geist-mono);
--typeset-size: 15px;
--typeset-leading: 1.75;
--typeset-flow: 1.25em;
}
4. Wrap your content
<div class="typeset typeset-notes max-w-[37em]">
${content}
</div>
One prompt with your picks baked in. Copy it and paste it into your coding agent.
Install shadcn/typeset in this WebJs app.
Typeset is a single stylesheet that styles rendered markdown: wrap the output in a `typeset` container and everything inside (headings, lists, tables, code, blockquotes, math) is styled. Everything outside is untouched.
1. Download https://webjs.up.railway.app/ui/typeset.css and save it as public/typeset.css, next to public/input.css (the Tailwind input the app compiles to public/tailwind.css). If the file already exists, replace it with the downloaded copy.
2. Import it in public/input.css, after the Tailwind import:
@import "./typeset.css";
3. Load the fonts with a stylesheet link in the root layout, app/layout.ts, inside <head>:
<!-- app/layout.ts, in <head> -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@100..900&family=Geist+Mono:wght@100..900&display=swap">
Then name them in public/input.css:
:root {
--font-geist: 'Geist', sans-serif;
--font-geist-mono: 'Geist Mono', monospace;
}
4. Add this preset to public/input.css, after the typeset import. If a class named .typeset-notes already exists, update its values in place. Leave any other typeset-* presets untouched: they are separate surfaces:
.typeset-notes {
--typeset-font-body: var(--font-geist);
--typeset-font-heading: var(--font-geist);
--typeset-font-mono: var(--font-geist-mono);
--typeset-size: 15px;
--typeset-leading: 1.75;
--typeset-flow: 1.25em;
}
5. Do not apply the class anywhere yet. Search the project for surfaces that render markdown or rich content: unsafeHTML holes fed parsed markdown, markdown renderers (marked, markdown-it, remark), prose classes, CMS content renderers. Present the candidates you find as a short list and ask the user which surface should use typeset. Then wrap only the surface they pick, in its html template:
<div class="typeset typeset-notes max-w-[37em]">
${content}
</div>
If the picked surface already has its own typography (a prose class, styled markdown elements), list those styles and let the user decide what to remove before wrapping.
Notes:
- To exclude an embedded component from typeset styles, add the not-typeset class or the data-not-typeset attribute to it.
- Verify on the surface the user picked: headings, lists, tables, and code inside the container should be styled with no classes on the content itself.
- Docs: https://ui.shadcn.com/docs/typeset