File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,7 +9,9 @@ const basePath = new URL(
99const baseDir = fileURLToPath ( basePath ) ;
1010
1111function extractSummary ( markdown : string ) : string {
12+ // Remove frontmatter (--- at the beginning)
1213 markdown = markdown . replace ( / ^ - - - [ \s \S ] + ?- - - \n / , "" ) ;
14+ // Normalize line breaks by collapsing consecutive newlines into a single space
1315 const normalizedText = markdown
1416 . split ( "\n" )
1517 . map ( ( line ) => line . trim ( ) )
@@ -24,15 +26,15 @@ function extractSummary(markdown: string): string {
2426 . replace (
2527 / \{ \{ \s * ( G l o s s a r y | H T M L E l e m e n t | S V G A t t r | S V G E l e m e n t | c s s x r e f | j s x r e f | H T T P H e a d e r ) \s * \( \s * [ " ' ] ( (?: \\ .| [ ^ " \\ ] ) * ?) [ " ' ] .* ?\) \s * \} \} / gi,
2628 "$2" ,
27- )
29+ ) // Extract first argument from multiple templates, handling escaped quotes & spaces
2830 . replace (
2931 / \{ \{ \s * d o m x r e f \s * \( \s * [ " ' ] ( (?: \\ .| [ ^ " \\ ] ) * ?) [ " ' ] [ ^ } ] * \) \s * \} \} / gi,
3032 "$1" ,
31- )
33+ ) // Extract first argument from domxref, handling spaces
3234 . replace (
3335 / \{ \{ \s * (?: e v e n t | j s x r e f | c s s r e f | s p e c n a m e ) \s * \| \s * ( [ ^ } ] + ) \s * \} \} / gi,
3436 "$1" ,
35- )
37+ ) // Handle event, jsxref, cssref, etc.
3638 . replace ( / \{ \{ \s * ( [ ^ } ] + ) \s * \} \} / g, ( _ , match ) => `[MISSING: ${ match } ]` )
3739 . replace ( / \[ ( .* ?) \] \( .* ?\) / g, "$1" )
3840 . replace ( / \s + / g, " " )
You can’t perform that action at this time.
0 commit comments