Socket
Socket
Sign inDemoInstall

@astrojs/prism

Package Overview
Dependencies
Maintainers
3
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@astrojs/prism

Add Prism syntax highlighting support to your Astro site


Version published
Weekly downloads
270K
increased by8.88%
Maintainers
3
Weekly downloads
 
Created

What is @astrojs/prism?

@astrojs/prism is an npm package that provides syntax highlighting for code blocks in Astro projects using the Prism.js library. It allows developers to easily integrate Prism.js into their Astro sites to highlight code in various programming languages.

What are @astrojs/prism's main functionalities?

Syntax Highlighting

This feature allows you to highlight code syntax for a specified language. In this example, JavaScript code is highlighted.

```astro
---
import { Prism } from '@astrojs/prism';
---

<Prism language="javascript">
  {`const hello = 'world';
console.log(hello);`}
</Prism>
```

Custom Themes

This feature allows you to apply custom themes to your code blocks. In this example, the 'prism-tomorrow' theme is applied to a CSS code block.

```astro
---
import { Prism } from '@astrojs/prism';
import 'prismjs/themes/prism-tomorrow.css';
---

<Prism language="css">
  {`body { background-color: #333; color: #fff; }`}
</Prism>
```

Line Numbers

This feature allows you to add line numbers to your code blocks. In this example, line numbers are added to a Python code block.

```astro
---
import { Prism } from '@astrojs/prism';
import 'prismjs/plugins/line-numbers/prism-line-numbers.css';
---

<Prism language="python" class="line-numbers">
  {`def hello_world():
    print('Hello, world!')`}
</Prism>
```

Other packages similar to @astrojs/prism

Keywords

FAQs

Package last updated on 11 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc