Skip to content

Commit e3fa14f

Browse files
author
Yubo-Cao
committed
Fix according to Ruslan
1 parent 699d3eb commit e3fa14f

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
3535
- We added an "Open example library" button to Welcome Tab. [#13014](https://github.com/JabRef/jabref/issues/13014)
3636
- We added automatic detection and selection of the identifier type (e.g., DOI, ISBN, arXiv) based on clipboard content when opening the "New Entry" dialog [#13111](https://github.com/JabRef/jabref/pull/13111)
3737
- We added support for import of a Refer/BibIX file format. [#13069](https://github.com/JabRef/jabref/issues/13069)
38-
- We added markdown rendering and copy-paste capabilities to AI chat responses. [#12234](https://github.com/JabRef/jabref/issues/12234)
38+
- We added markdown rendering and copy capabilities to AI chat responses. [#12234](https://github.com/JabRef/jabref/issues/12234)
3939
- We added a new `jabkit` command `pseudonymize` to pseudonymize the library. [#13109](https://github.com/JabRef/jabref/issues/13109)
4040
- We added functionality to focus running instance when trying to start a second instance. [#13129](https://github.com/JabRef/jabref/issues/13129)
4141
- We added a highlighted diff regarding changes to the Group Tree Structure of a bib file, made outside JabRef. [#11221](https://github.com/JabRef/jabref/issues/11221)

jabgui/src/main/java/org/jabref/gui/util/MarkdownTextFlow.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,15 +320,23 @@ private void visit(FencedCodeBlock codeBlock) {
320320
* ``` -> contains content `\npublic class HelloWorld { ... }\n\n`
321321
* Therefore, we need to remove the first and last characters.
322322
*/
323-
addTextNode(content.substring(1, content.length() - 2), codeBlock, "markdown-code-block");
323+
String processedContent = content;
324+
if (content.length() >= 3 && content.startsWith("\n") && content.endsWith("\n\n")) {
325+
processedContent = content.substring(1, content.length() - 2);
326+
}
327+
addTextNode(processedContent, codeBlock, "markdown-code-block");
324328
previousBlock = codeBlock;
325329
}
326330

327331
private void visit(IndentedCodeBlock codeBlock) {
328332
addNewlinesBetweenBlocks(codeBlock);
329333
String content = codeBlock.getContentChars().toString();
330334
// NOTE: Similar to FencedCodeBlock, Flexmark always appends \n at the beginning and \n\n at the end.
331-
addTextNode(content.substring(1, content.length() - 2), codeBlock, "markdown-code-block");
335+
String processedContent = content;
336+
if (content.length() >= 3 && content.startsWith("\n") && content.endsWith("\n\n")) {
337+
processedContent = content.substring(1, content.length() - 2);
338+
}
339+
addTextNode(processedContent, codeBlock, "markdown-code-block");
332340
previousBlock = codeBlock;
333341
}
334342

jabgui/src/main/resources/org/jabref/gui/Base.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@
262262
-jr-header-height: 3em;
263263

264264
/* AI chat style */
265-
-jr-ai-message-user: -jr-accent;
265+
-jr-ai-message-user: derive(-jr-accent, 50%);
266266
-jr-ai-message-user-border: -jr-theme;
267-
-jr-ai-message-ai: -jr-accent;
267+
-jr-ai-message-ai: derive(-jr-accent, 80%);
268268
-jr-ai-message-ai-border: -jr-theme;
269269
-jr-ai-message-error: -jr-error;
270270
-jr-ai-message-error-border: derive(-jr-error, -40%);

0 commit comments

Comments
 (0)