GitXplorerGitXplorer
D

vite-plugin-asciidoc

public
3 stars
1 forks
3 issues

Commits

List of commits on branch master.
Unverified
0df1a1338ff38ae12f44c4268e64ab9c51ecc00a

chore(release): 0.0.2

DDjaler committed 3 years ago
Unverified
8322cabf9955a82a8bf199b4b07af5235b9cf084

build: remove bundledDependencies

DDjaler committed 3 years ago
Unverified
0c379900f5adafe88411e6ecffd851219db1ec30

chore(release): 0.0.1

DDjaler committed 3 years ago
Unverified
94d2f1f46fee3855bd77bdf56d2fcacac521df30

feat: initial

DDjaler committed 3 years ago
Unverified
cb026d60cfdbafd86fc8e65b9909f0ea727ef133

Initial commit

DDjaler committed 3 years ago

README

The README file for this repository.

npm

Vite Plugin for Asciidoc

Vite plugin to import .adoc files as html

Install

npm install -D vite-plugin-asciidoc

Usage

In your vite configuration:

import { createAsciidocPlugin } from 'vite-plugin-asciidoc';

export default {
    // ...
    plugins: [
        createAsciidocPlugin()
    ]
}

In your code:

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. 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:

declare module '*.adoc' {
    const content: string;
    export default content;

    const attributes: Record<string, unknown>;
    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 for the html assets processing code.

License

The package is available as open source under the terms of the MIT License.