Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/djaler/vite-plugin-asciidoc
Vite plugin to import adoc files as html
https://github.com/djaler/vite-plugin-asciidoc
adoc asciidoc asciidoctor vite vitejs
Last synced: 10 days ago
JSON representation
Vite plugin to import adoc files as html
- Host: GitHub
- URL: https://github.com/djaler/vite-plugin-asciidoc
- Owner: Djaler
- Created: 2021-11-06T20:42:26.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-11-03T08:00:55.000Z (about 1 year ago)
- Last Synced: 2024-10-14T08:26:37.939Z (about 1 month ago)
- Topics: adoc, asciidoc, asciidoctor, vite, vitejs
- Language: TypeScript
- Homepage:
- Size: 6.84 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
[![npm](https://img.shields.io/npm/v/vite-plugin-asciidoc?style=for-the-badge)](https://www.npmjs.com/package/vite-plugin-asciidoc)
# Vite Plugin for Asciidoc
> Vite plugin to import .adoc files as html
## Install
```sh
npm install -D vite-plugin-asciidoc
```## Usage
In your vite configuration:
```javascript
import { createAsciidocPlugin } from 'vite-plugin-asciidoc';export default {
// ...
plugins: [
createAsciidocPlugin()
]
}
```In your code:
```javascript
import help, { attributes } from './help.adoc';console.log(help); // adoc file converted to html
console.log(attributes); // attributes of source adoc file
```## Configuration
You can specify most of the options that comes
to [asciidoctor](https://docs.asciidoctor.org/asciidoctor.js/latest/processor/convert-options/). Few of them:- `attributes` - Any number of built-in or user-defined attributes;
- `safe` - Safe mode (unsafe, safe, server or secure).## Typescript
In TypeScript project you will need to declare typedefs for `.adoc` files:
```typescript
declare module '*.adoc' {
const content: string;
export default content;const attributes: Record;
export { attributes };
}
```Save it as `shims-adoc.d.ts` for instance.
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/djaler/vite-plugin-asciidoc.
## Thanks
Thanks to [html-loader](https://github.com/webpack-contrib/html-loader) for the html assets processing code.
## License
The package is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).