Skip to content

Commit

Permalink
refactor(#62): improve code readability
Browse files Browse the repository at this point in the history
  • Loading branch information
meganesu committed Jun 19, 2024
1 parent dd9596b commit 026e6a8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/code-block/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
const CodeBlock = (props) => {
const code = props.children.props.children.trim()

const className = props.children.props.className || ""
const language = className.replace(/language-/, "")
const languageClassName = props.children.props.className || ""
const language = languageClassName.replace(/language-/, "")

const fileTitle = props.title || ""

Expand All @@ -29,7 +29,9 @@ const CodeBlock = (props) => {
<span aria-label="file">📄</span> {fileTitle}
</div>
)}
{language && <div className={languageTagStyles}>{language}</div>}
{language != "" &&
<div className={languageTagStyles}>{language}</div>
}
<div className={preWrapperStyles}>
<SyntaxHighlightWrapper
code={code}
Expand Down

0 comments on commit 026e6a8

Please sign in to comment.