Skip to content

Commit a242ad1

Browse files
author
rmmayo
committed
#2564 - replace double new lines following a paren heading with a single newline
1 parent dc344e3 commit a242ad1

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

service/src/main/java/skills/services/CustomValidator.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class CustomValidator {
8282
private static final Pattern TABLE_FIX = ~/(?m)(^\n)(^[|].+[|]$\n^[|].*[-]{3,}.*[|]$)/
8383
private static final Pattern CODEBLOCK_FIX = ~/(?m)(^\n)(^[`]{3}$)/
8484
private static final Pattern LIST_FIX = ~/(?m)(^\n)(\s*\d\. |\* |- .*$)/
85+
private static final Pattern HEADING_FIX = ~/(?m)([(].+[)].*$)\n(\n.*$)/
8586

8687
@PostConstruct
8788
CustomValidator init() {
@@ -249,6 +250,7 @@ class CustomValidator {
249250
toValidate = TABLE_FIX.matcher(toValidate).replaceAll('$2')
250251
toValidate = CODEBLOCK_FIX.matcher(toValidate).replaceAll('$2')
251252
toValidate = LIST_FIX.matcher(toValidate).replaceAll('$2')
253+
toValidate = HEADING_FIX.matcher(toValidate).replaceAll('$1$2')
252254

253255
// remove two+ newlines from codeblocks so we do not split
254256
StringBuilder out = new StringBuilder()

0 commit comments

Comments
 (0)