Skip to content

Commit 37d33d6

Browse files
fix(client-runtime): a tab after up to three spaces counts as indented code
Markdown expands it to the fourth column, so a cell indented that way still rendered as a code block. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a8af23e commit 37d33d6

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎packages/client-runtime/src/pullRequestMarkdown.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ describe("media tables", () => {
244244
"<table>\n <tr>\n <th>\n Before\n </th>\n </tr>\n <tr><td>",
245245
"</td></tr>\n</table>",
246246
],
247+
[
248+
"a cell indented by a space and a tab",
249+
"<table>\n<tr><td>\n \tBefore\n</td><td>",
250+
"</td></tr>\n</table>",
251+
],
247252
])("splits a media table with %s line by line, as before", (_name, open, close) => {
248253
const body = `${open}\n\n${video}\n\n${close}`;
249254
expect(splitPullRequestBody(body)).toEqual([

‎packages/client-runtime/src/pullRequestMarkdown.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ const FENCE_PATTERN = /^\s{0,3}((?:`{3,})|(?:~{3,}))(.*)\r?$/u;
3434
*/
3535
const VIDEO_TAG_MAX_LINES = 8;
3636

37-
const INDENTED_CODE_PATTERN = /^(?: {4}|\t)/u;
37+
// A tab after up to three spaces still reaches the fourth column.
38+
const INDENTED_CODE_PATTERN = /^(?: {4}| {0,3}\t)/u;
3839
const BARE_URL_PATTERN = /^<?(https?:\/\/\S+?)>?$/u;
3940
const IMAGE_EXTENSION_PATTERN = /\.(?:png|jpe?g|gif|webp|avif|heic|heif|svg)(?:$|[?#])/iu;
4041
const MARKDOWN_LINK_PATTERN = /^\[[^\]]*\]\((https?:\/\/[^\s)]+)\)$/u;

0 commit comments

Comments
 (0)