GeezerVison is showing github.com — fix(server): keep markup literal after an over-indented fence in PR r… · pingdotgg/t3code@1d4d1f7
File tree
Expand file treeCollapse file tree
Open diff view settings
apps/server/src/orchestration-v2
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/pullRequestWatch.test.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1096,8 +1096,8 @@ Review triggered. |
1096 | 1096 | ], |
1097 | 1097 | [ |
1098 | 1098 | "code spans and fences", |
1099 | | - "Replace `<div>` with ``<span>``:\n~~~html\n<p>Done</p>\n~~~\r\nor\r\n```html\r\n<b>Done</b>\r\n```", |
1100 | | - "Replace `<div>` with ``<span>``: ~~~html <p>Done</p> ~~~ or ```html <b>Done</b> ```", |
| 1099 | + "Replace `<div>` with ``<span>``:\n~~~html\n<p>Done</p>\n~~~\r\nor\r\n```html\r\n<b>Done</b>\r\n ```\r\n<div>KEEP</div>\r\n ```\r\n<i>after</i>", |
| 1100 | + "Replace `<div>` with ``<span>``: ~~~html <p>Done</p> ~~~ or ```html <b>Done</b> ``` <div>KEEP</div> ``` after", |
1101 | 1101 | ], |
1102 | 1102 | [ |
1103 | 1103 | "indented code", |
|
Collapse file
Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/pullRequestWatch.ts +6-2Lines changed: 6 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -359,8 +359,12 @@ function withoutMarkup(body: string): string { |
359 | 359 | }; |
360 | 360 | for (const line of body.split("\n")) { |
361 | 361 | if (fence !== undefined) { |
362 | | - const closer = line.trim(); |
363 | | - if (closer.length >= fence.length && closer.replaceAll(fence.charAt(0), "") === "") { |
| 362 | + const closer = /^ {0,3}(`{3,}|~{3,})[ \t]*\r?$/.exec(line)?.[1]; |
| 363 | + if ( |
| 364 | + closer !== undefined && |
| 365 | + closer.charAt(0) === fence.charAt(0) && |
| 366 | + closer.length >= fence.length |
| 367 | + ) { |
364 | 368 | fence = undefined; |
365 | 369 | } |
366 | 370 | code(line); |
|