Skip to content

Commit 5789f56

Browse files
author
Fr4gm3nt3d_sh
committed
Update .github/workflows/llmcodereview.yml
1 parent 6c6809d commit 5789f56

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

.github/workflows/llmcodereview.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ jobs:
5656
1. What the problem is (1-2 sentences)
5757
2. Why it matters (1 sentence)
5858
3. How to fix it (code example or brief explanation)
59-
4. Don't use Italic
60-
59+
6160
Return the review in clean, well-formatted markdown with sections and code blocks.
6261
Keep the total response under 1000 words.
6362
@@ -81,18 +80,20 @@ jobs:
8180
const markdownToHtml = (md) => {
8281
// Extract code blocks and inline code first
8382
const codeBlocks = [];
83+
const inlineCode = [];
84+
8485
let html = md.replace(/```[\s\S]*?```/g, (match) => {
8586
const code = match.substring(3, match.length - 3).trim();
86-
const placeholder = '___CODEBLOCK_' + codeBlocks.length + '___';
87+
const idx = codeBlocks.length;
8788
codeBlocks.push(code);
88-
return placeholder;
89+
return '\n__CODEBLOCK' + idx + '__\n';
8990
});
9091
91-
const inlineCode = [];
9292
html = html.replace(/`[^`]+`/g, (match) => {
93-
const placeholder = '___INLINECODE_' + inlineCode.length + '___';
94-
inlineCode.push(match.substring(1, match.length - 1));
95-
return placeholder;
93+
const code = match.substring(1, match.length - 1);
94+
const idx = inlineCode.length;
95+
inlineCode.push(code);
96+
return '__INLINE' + idx + '__';
9697
});
9798
9899
html = escapeHtml(html);
@@ -104,7 +105,7 @@ jobs:
104105
html = html.replace(/^## (.*?)$/gm, '<h2>$1</h2>');
105106
html = html.replace(/^# (.*?)$/gm, '<h1>$1</h1>');
106107
107-
// Bold and italic - only keep bold, remove italic conversions
108+
// Bold only (no italics)
108109
html = html.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
109110
html = html.replace(/__(.*?)__/g, '<strong>$1</strong>');
110111
@@ -125,18 +126,18 @@ jobs:
125126
html = html.replace(/(<\/h[1-6]>)<\/p>/g, '$1');
126127
html = html.replace(/<p>(<ul>)/g, '$1');
127128
html = html.replace(/(<\/ul>)<\/p>/g, '$1');
128-
html = html.replace(/<p>___CODEBLOCK_/g, '___CODEBLOCK_');
129-
html = html.replace(/___<\/p>/g, '___');
129+
html = html.replace(/<p>\n__CODEBLOCK/g, '\n__CODEBLOCK');
130+
html = html.replace(/__CODEBLOCK\d+__\n<\/p>/g, (match) => match.replace('<\/p>', ''));
130131
html = html.replace(/<p><\/p>/g, '');
131132
132133
// Restore inline code
133134
inlineCode.forEach((code, i) => {
134-
html = html.replace('___INLINECODE_' + i + '___', '<code>' + escapeHtml(code) + '</code>');
135+
html = html.replace(new RegExp('__INLINE' + i + '__', 'g'), '<code>' + escapeHtml(code) + '</code>');
135136
});
136137
137138
// Restore code blocks
138139
codeBlocks.forEach((code, i) => {
139-
html = html.replace('___CODEBLOCK_' + i + '___', '<pre><code>' + escapeHtml(code) + '</code></pre>');
140+
html = html.replace(new RegExp('\n?__CODEBLOCK' + i + '__\n?', 'g'), '<pre><code>' + escapeHtml(code) + '</code></pre>');
140141
});
141142
142143
return html;

0 commit comments

Comments
 (0)