Skip to content

Commit

Permalink
Fix capitalization of alert name in GitHub alert HOC (#4083)
Browse files Browse the repository at this point in the history
* fix capitalization of alert name in GitHub alert HOC

* improve github alert syntax name in DOM

---------

Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
  • Loading branch information
hichemfantar and dimaMachina authored Jan 28, 2025
1 parent 29a44de commit 19578c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/nice-weeks-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextra": patch
---

improve github alert syntax name in DOM
7 changes: 3 additions & 4 deletions packages/nextra/src/client/hocs/with-github-alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,13 @@ export function withGitHubAlert(
`Invalid GitHub alert type: "${alertName}". Should be one of: ${GITHUB_ALERTS.join(', ')}.`
)
}
const capitalizedName =
alertName[0]!.toUpperCase() + alertName.slice(1)
return fn({
...props,
type: alertName as T,
children: [
<b key={0}>
{alertName[0]!.toUpperCase()}
{alertName.slice(1)}
</b>,
<b key={0}>{capitalizedName}</b>,
...props.children.slice(2)
]
})
Expand Down

0 comments on commit 19578c3

Please sign in to comment.