Skip to content

Commit 35283f6

Browse files
author
Ruben Gomez
committed
Fixed chat-history view
1 parent 2b666d6 commit 35283f6

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

polaris/components/base.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ class BaseComponent extends HTMLElement {
167167
text = text.replace(/_orakle_loading_signal_\|([^ \n]+)/gm, '<span class="orakle-skill" title="Orakle Skill">$1</span>');
168168

169169
// Extract and replace triple backtick code blocks
170-
text = text.replace(/```([\s\S]*?)```/gm, (match, content) => {
170+
text = text.replace(/```([^ \n]+)([\s\S]*?)```/gm, (match, codetype, content) => {
171171
codeBlocks.push(`<div class="code-block-wrapper">
172+
<span class="code-type">${codetype}</span>
172173
<button class="copy-btn" onclick="navigator.clipboard.writeText(this.nextElementSibling.textContent)">Copy</button>
173174
<code>${content}</code>
174175
</div>`);

polaris/components/document-view.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,23 @@ code {
205205
position: relative;
206206
margin: 8px 4px;
207207
}
208+
.code-type {
209+
position: absolute;
210+
top: 4px;
211+
left: 8px;
212+
font-family: 'Menlo', 'Consolas', monospace;
213+
font-size: 14px;
214+
line-height: 1.5;
215+
white-space: pre-wrap;
216+
display: inline-block;
217+
max-width: 98%;
218+
border-radius: 5px;
219+
margin: 4px;
220+
/* padding: 2px 4px; */
221+
/* background-color: #444; */
222+
font-weight: bold;
223+
color: #FFF;
224+
}
208225
.copy-btn {
209226
position: absolute;
210227
top: 8px;
@@ -227,4 +244,5 @@ code {
227244
display: block;
228245
padding: 12px;
229246
margin: 0;
247+
margin-top: 40px;
230248
}

0 commit comments

Comments
 (0)