@@ -9,27 +9,6 @@ import {
99 util ,
1010} from 'comment-parser' ;
1111
12- /**
13- * Detects if a line starts with a markdown list marker
14- * Supports: -, *, numbered lists (1., 2., etc.)
15- * This explicitly excludes hyphens that are part of JSDoc tag syntax
16- * @param {string } text - The text to check
17- * @param {boolean } isFirstLineOfTag - True if this is the first line (tag line)
18- * @returns {boolean } - True if the text starts with a list marker
19- */
20- const startsWithListMarker = ( text , isFirstLineOfTag = false ) => {
21- // On the first line of a tag, the hyphen is typically the JSDoc separator,
22- // not a list marker
23- if ( isFirstLineOfTag ) {
24- return false ;
25- }
26-
27- // Match lines that start with optional whitespace, then a list marker
28- // - or * followed by a space
29- // or a number followed by . or ) and a space
30- return / ^ \s * (?: [ \- * ] | \d + (?: \. | \) ) ) \s + / v. test ( text ) ;
31- } ;
32-
3312/**
3413 * @typedef {{
3514 * hasNoTypes: boolean,
@@ -336,45 +315,9 @@ const alignTransform = ({
336315
337316 // Not align.
338317 if ( shouldAlign ( tags , index , source ) ) {
339- // Save original postDelimiter before alignTokens modifies it
340- const originalPostDelimiter = tokens . postDelimiter ;
341- // Remove the delimiter space
342- const originalIndent = tokens . postDelimiter . slice ( 1 ) ;
343-
344318 alignTokens ( tokens , typelessInfo ) ;
345-
346319 if ( ! disableWrapIndent && indentTag ) {
347- // Preserve extra indentation for list continuation lines
348- // Check if any previous line (or current) in the current tag has a list marker
349- let hasListMarker = false ;
350-
351- // Find the start of the current tag
352- let tagStartIndex = index ;
353- while ( tagStartIndex > 0 && source [ tagStartIndex ] . tokens . tag === '' ) {
354- tagStartIndex -- ;
355- }
356-
357- // Check all lines from tag start to current line for list markers
358- for ( let idx = tagStartIndex ; idx <= index ; idx ++ ) {
359- const isFirstLine = ( idx === tagStartIndex ) ;
360- if ( source [ idx ] ?. tokens ?. description && startsWithListMarker ( source [ idx ] . tokens . description , isFirstLine ) ) {
361- hasListMarker = true ;
362- break ;
363- }
364- }
365-
366- // If we're in a list context and this line has extra indentation beyond wrapIndent,
367- // preserve the original indentation
368- const hasExtraIndent = originalIndent . length > wrapIndent . length &&
369- originalIndent . startsWith ( wrapIndent ) ;
370-
371- if ( hasListMarker && hasExtraIndent ) {
372- // Preserve the original indentation completely
373- tokens . postDelimiter = originalPostDelimiter ;
374- } else {
375- // Normal case: add wrapIndent after the aligned delimiter
376- tokens . postDelimiter += wrapIndent ;
377- }
320+ tokens . postDelimiter += wrapIndent ;
378321 }
379322 }
380323
0 commit comments