Skip to content

Commit f85c76f

Browse files
authored
fix: Markdown incorrectly rendering inline code blocks (#2342)
- Fixes #2312 - Tested using a code block from the ticket ![image](https://github.com/user-attachments/assets/11adc367-c421-43a8-aadd-9de146a598ee)
1 parent 3b5c7d3 commit f85c76f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/dashboard-core-plugins/src/controls/markdown/MarkdownEditor.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ interface MarkdownEditorProps {
1313
}
1414

1515
const renderMarkdown: CodeComponent = props => {
16-
const { children, className } = props;
16+
const { children, inline, className } = props;
17+
if (inline === true) {
18+
return (
19+
<code>
20+
{React.Children.map(children, child =>
21+
typeof child === 'string' ? child.trim() : child
22+
)}
23+
</code>
24+
);
25+
}
1726
const language =
1827
className !== undefined && className?.startsWith('language-')
1928
? className.substring(9)

packages/dashboard-core-plugins/src/panels/MarkdownPanel.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ $panel-container-padding: 10px;
3636
code {
3737
color: $foreground;
3838
background: $gray-700;
39-
padding: 2px $spacer-2;
39+
padding: 0.2em;
4040
border-radius: $border-radius;
4141
border: 1px solid $black;
4242
}

0 commit comments

Comments
 (0)