vite-plugin-asciidoc-378

Форк
0

3 года назад
3 года назад
3 года назад
3 года назад
3 года назад
3 года назад
3 года назад
3 года назад
3 года назад
3 года назад
3 года назад
3 года назад
README.md

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.

Описание

Vite plugin to import adoc files as html

Языки

TypeScript

  • JavaScript
Сообщить о нарушении

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.