Adding visual flair to your technical blog posts can make content more engaging and easier to parse. We’ve replaced the old ASCIIBrackets
component with the new CodeBrackets
component—a more descriptive and intuitive name for wrapping content in programming-style brackets.
Getting Started
-
Import the Component
In your
.astro
page or layout, importCodeBrackets
:--- import CodeBrackets from '../components/CodeBrackets.astro'; ---
-
Wrap Your Content
Use the component to enclose any section of your blog content:
<CodeBrackets type="python" color="green" label="example.py"> <pre> def hello_world(): print("Hello, CodeBrackets!") </pre> </CodeBrackets>
-
Explore Bracket Styles
Visit the Bracket Styles Showcase page to see all available bracket types, sizes, and color options.
Component Props
type
(optional): Specifies the bracket style. Options includejs-object
,html
,jsx
,css
,python
,markdown
,sql
,bash
,security-report
,code-review
,vulnerability
,square
,curly
,angle
,pipe
. Defaults tosquare
.size
(optional):small
,medium
, orlarge
. Defaults tomedium
.color
(optional): Theme colors likeblue
,green
,yellow
,orange
,violet
,cyan
,red
,teal
,purple
. Defaults toviolet
.label
(optional): A label displayed on the bracket (e.g., filename or title).
Pro Tips
- Use
markdown
brackets for content-heavy sections like how-to guides. - Combine
security-report
orcode-review
brackets for security-focused posts.
Enjoy styling your blog posts with CodeBrackets
—happy coding!