Skip to content

Commit bd57418

Browse files
committed
fix: improve plain text whitespace collapsing and prevent HTML escaping in raw content
- Use (\s*\n){3,} regex to properly collapse whitespace-mixed blank lines - Add safeHTML pipe to preserve HTML tags in RawContent output
1 parent 5de2093 commit bd57418

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

assets/js/copy-to-llm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
}
5959
});
6060

61-
return clone.textContent.replace(/\n{3,}/g, '\n\n').trim();
61+
return clone.textContent.replace(/(\s*\n){3,}/g, '\n\n').trim();
6262
}
6363

6464
function copyContent(type) {

layouts/partials/copy-to-llm.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
</div>
2525

2626
{{/* Embed raw markdown for copy-as-markdown */}}
27-
<script id="copy-fulltext-markdown" type="text/plain">{{ .RawContent }}</script>
27+
<script id="copy-fulltext-markdown" type="text/plain">{{ .RawContent | safeHTML }}</script>

0 commit comments

Comments
 (0)