Skip to content

Commit b712a86

Browse files
Replace language with filename; optionally both
1 parent fd770ac commit b712a86

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

components/blocks/code.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const Code = ({
6161
lines,
6262
hideCopyButton = false,
6363
filename,
64+
filenameOnly = true,
6465
}) => {
6566
// Create a ref for the code element.
6667
const codeRef = useRef(null);
@@ -125,7 +126,8 @@ const Code = ({
125126
// Extract language identifier for display
126127
const langId = languageClass?.substring(9) || language || "python";
127128
const displayLanguage = languageDisplayNames[langId] || langId;
128-
const showLanguage = langId.toLowerCase() !== "none";
129+
const showLanguage =
130+
langId.toLowerCase() !== "none" && !(filenameOnly && filename);
129131

130132
const Header = (
131133
<div className={classNames(styles.Header, "code-block-header")}>

content/develop/concepts/configuration/theming-fonts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ codeFont="noto-mono"
131131

132132
Directory structure:
133133

134-
<Code language="none" filename="directory structure">
134+
<Code language="none" filename="Directory structure">
135135

136136
project_directory/
137137
├── .streamlit/

0 commit comments

Comments
 (0)