Home / Companies / Mintlify / Blog / Post Details
Content Deep Dive

Building an LSP for your docs

Blog post from Mintlify

Post Details
Company
Date Published
Author
Ricardo Nunez
Word Count
1,323
Language
English
Hacker News Points
-
Summary

Mintlify has integrated a new library called Twoslash into its platform to enhance developer documentation by providing an IDE-like experience that shows type information on hover in code examples. Twoslash, which has rapidly gained popularity, works by creating an in-memory TypeScript project and using the TypeScript compiler to add type annotations into a virtual file system, allowing users to see type information without adding extra JavaScript. Despite its effectiveness locally, Mintlify faced challenges deploying it to Vercel due to missing TypeScript type definitions, as Vercel's serverless functions only include compiled output, excluding necessary type files. To resolve this, Mintlify used Next.js's outputFileTracingIncludes setting to ensure the inclusion of required TypeScript types in the build output, successfully enabling Twoslash to function correctly on Vercel. This feature is available for TypeScript and JavaScript code blocks, providing developers with enhanced documentation capabilities.