vitepress-openapi
Version:
Generate VitePress API Documentation from OpenAPI Specification.
10 lines (8 loc) • 321 B
text/typescript
const WHITESPACE_REGEX = /\s+/g
/**
* Minifies a string of HTML by replacing multiple whitespace characters with a single space
* and trimming the result. This helps prevent hydration mismatches in VitePress.
*/
export function minifyHtml(html: string): string {
return html.replace(WHITESPACE_REGEX, ' ').trim()
}