SenY commited on
Commit
47610c9
·
1 Parent(s): 885aa07

字下げボタン追加

Browse files
Files changed (1) hide show
  1. index.html +5 -8
index.html CHANGED
@@ -455,17 +455,14 @@
455
  continue;
456
  }
457
 
458
- // 括弧類で始まる行は字下げしない
459
  const startsWithBracket = /^[「『(\((【〔[{]/.test(line);
 
460
 
461
- // 段落の開始を判定
462
- // 前の行が空行、または行末が句点(。)、疑問符(?)、感嘆符(!)、ハートマーク(♡♥❤)で終わっている場合
463
- // 感嘆符の組み合わせ(!?、!!、?!など)も考慮
464
- const isNewParagraph = (i === 0) ||
465
- (processedLines[i - 1] === '') ||
466
- /[。?!♡♥❤]([!?!?♡♥❤])*$/.test(processedLines[i - 1]);
467
 
468
- if (isNewParagraph && !startsWithBracket) {
469
  // 段落の最初の行には全角スペース1文字分の字下げを追加
470
  processedLines.push(' ' + line);
471
  } else {
 
455
  continue;
456
  }
457
 
458
+ // 括弧類やMarkdown見出しで始まる行は字下げしない
459
  const startsWithBracket = /^[「『(\((【〔[{]/.test(line);
460
+ const startsWithMarkdownHeader = /^#+/.test(line);
461
 
462
+ // 段落の開始を判定(常にtrue)
463
+ const isNewParagraph = true;
 
 
 
 
464
 
465
+ if (isNewParagraph && !startsWithBracket && !startsWithMarkdownHeader) {
466
  // 段落の最初の行には全角スペース1文字分の字下げを追加
467
  processedLines.push(' ' + line);
468
  } else {