cz-typography
Version:
Universal Czech typography fixer for JavaScript, React, Next.js, and any SSR framework. Non-breaking spaces after one-letter prepositions, units, dates, ordinals and more.
44 lines (40 loc) • 1.21 kB
text/typescript
import { F as FixCzechOptions } from '../fixCzech-CCow6rWW.cjs';
import { NextResponse } from 'next/server';
/**
* Build a Next.js middleware that pipes every HTML response through
* {@link createFixCzechStream}. Streaming-friendly – the response body
* is not buffered, which keeps Suspense and RSC payload behaviour
* intact.
*
* Usage in `middleware.ts`:
*
* ```ts
* import { withCzTypography } from 'cz-typography/next/middleware';
*
* export const middleware = withCzTypography();
*
* export const config = {
* matcher: '/((?!api|_next/static|_next/image|favicon.ico).*)',
* };
* ```
*
* @param {WithCzTypographyOptions} [config]
*/
declare function withCzTypography(config?: WithCzTypographyOptions): (request: any) => Promise<NextResponse<unknown>>;
type WithCzTypographyOptions = {
/**
* Rule toggles.
*/
options?: FixCzechOptions;
/**
* Custom predicate – return false to skip.
*/
shouldProcess?: (request: any) => boolean;
/**
* Content-Type substrings that trigger transformation.
*/
contentTypes?: string[];
};
// @ts-ignore
export = withCzTypography;
export { type WithCzTypographyOptions, withCzTypography };