# astro-pintora

> An Astro component for Pintora diagrams

Latest version **0.0.2** (published 2024-01-24) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install astro-pintora
pnpm add astro-pintora
yarn add astro-pintora
bun add astro-pintora
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2024-01-24 |
| First published | 2023-12-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 2 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tex0l |
| Keywords | astro-component, pintora, mermaid, diagram, flowchart, charts |

## Links

- npm: https://www.npmjs.com/package/astro-pintora
- Homepage: https://github.com/tex0l/astro-pintora
- npm.io page: https://npm.io/package/astro-pintora

## Dependencies (2)

- [@pintora/cli](https://npm.io/package/@pintora/cli.md) ^0.6.3
- [@pintora/standalone](https://npm.io/package/@pintora/standalone.md) ^0.6.3

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2024-01-24
- 0.0.3-6 (beta) — 2024-06-20
- 0.0.3-5 — 2024-06-20
- 0.0.3-4 — 2024-02-29
- 0.0.3-3 — 2024-02-29
- 0.0.3-2 — 2024-02-29
- 0.0.3-1 — 2024-02-29
- 0.0.3-0 — 2024-02-27
- 0.0.1 — 2023-12-13
- 0.0.1-2 — 2023-12-13
- 0.0.1-1 — 2023-12-13

## README

# Astro Pintora
This package aims at making an of-the-shelves Astro Component for [Pintora](https://pintorajs.vercel.app/) diagrams.

## Quick start
You can install `astro-pintora` as follows:

```shell
npm install astro-pintora
# OR
yarn add astro-pintora
# OR
pnpn install astro-pintora
```

And use it as follows in a page:
```astro
--- 
import Pintora from 'astro-pintora'
--- 
<Pintora code={`
activityDiagram
  title: Activity Diagram Simple Action
  :Action 1;
  :Action 2;
`}/>
```

## Props
This component accepts two props:
- `code: string`: the Pintora diagram declaration
- `renderOptions?: RenderOptions`: the rest of the [CLIRenderOptions](https://pintorajs.vercel.app/docs/advanced/api-usage/#renderoptions):
  - `devicePixelRatio?: number`: the pixel ratio.
  - `mimeType?: 'image/png' | 'image/jpeg' | 'image/svg+xml'`: specifies the output format. Defaults to `'image/png'`.
  - `backgroundColor?: string`: the background color.
  - `pintoraConfig?: Partial<PintoraConfig>`: the Pintora config object, can be used to override the theme through `pintoraConfig.themeConfig.theme`.
  - `width?: number`: width of the output.

For example, to render an SVG with a transparent background that uses the `dark` theme:

```astro
--- 
import Pintora, { type RenderOptions } from 'astro-pintora'

const renderOptions: RenderOptions = {
  mimeType: 'image/svg+xml',
  backgroundColor: 'transparent',
  pintoraConfig: { themeConfig: { theme: 'dark' } }
}
--- 
<Pintora code={`
activityDiagram
  title: Activity Diagram Simple Action
  :Action 1;
  :Action 2;
`}
renderOptions={renderOptions}/>
```

## Acknowledgments
The structure of the package is inspired by [`astro-diagrams`](https://github.com/JulianCataldo/web-garden/tree/develop/components/Diagram) which aims at providing an equivalent Astro component for Mermaid diagrams.

Many thanks to [@hikerpig](https://github.com/hikerpig) who maintains [Pintora](https://github.com/hikerpig/pintora) for the quick support.

---
_Source: https://npm.io/package/astro-pintora · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
