FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
maxm
maxmcodemirrorTsBrowser
Public
Like
codemirrorTsBrowser
Home
Code
2
README.md
main.tsx
Branches
1
Pull requests
Remixes
3
History
Environment variables
Settings
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Sign up now
Code
/
Code
/
Search
README.md

codemirror-ts

You can import this a val like this in browser to run codemirror-ts. Bundling done with esm.sh.

Working demo: preview / source

Run an editor like so:

Create val
/** @jsxImportSource https://esm.sh/react */ import { renderToString } from "npm:react-dom/server"; export default async function(req: Request): Promise<Response> { return new Response( renderToString( <> <script type="module" src="https://esm.town/v/maxm/codemirrorTsBrowser" /> <form> <textarea id="editorSource" className="for-codemirror" name="editorSource"> {`let hasAnError: string = 10; function increment(num: number) { return num + 1; } increment('not a number');`} </textarea> <button id="submit" type="submit">Submit</button> </form> </>, ), { headers: { "content-type": "text/html" } }, ); }
Code
README.mdmain.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.