Coder Social home page Coder Social logo

vite-plugin-asciidoc's Introduction

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-asciidoc's People

Contributors

djaler avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

janleslie

vite-plugin-asciidoc's Issues

How to pass options/attributes when doing the conversion?

In the readme, it mentioned

    safe - Safe mode (unsafe, safe, server or secure).

How to specify the attributes passing to Asciidoctor?
I want to pass an attribute skip-front-matter: true when doing the conversion.
I am experimenting with Astro.

Thanks in advance.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @djaler/eslint-config-typescript to v0.0.9
  • chore(deps): update dependency standard-version to v9.5.0
  • build(deps): update dependency typescript to v5
  • build(deps): update dependency vite to v4
  • chore(deps): update dependency @types/node to v20
  • chore(deps): update dependency eslint-import-resolver-typescript to v3
  • chore(deps): update dependency lint-staged to v15
  • chore(deps): update dependency rimraf to v5
  • chore(deps): update pnpm to v8
  • ci(deps): update actions/checkout action to v4
  • ci(deps): update actions/setup-node action to v4
  • fix(deps): update dependency asciidoctor to v3
  • fix(deps): update dependency html-loader to v4
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/checks.yml
  • actions/checkout v2
  • actions/setup-node v2
  • actions/cache v2
  • actions/checkout v2
  • actions/setup-node v2
  • actions/cache v2
  • reviewdog/action-eslint v1
.github/workflows/release.yml
  • actions/checkout v2
  • actions/setup-node v2
  • actions/cache v2
  • filipstefansson/set-npm-token-action v1
npm
package.json
  • asciidoctor ^2.2.5
  • html-loader 3.0.1
  • @djaler/conventional-changelog-standard 1.2.0
  • @djaler/eslint-config-typescript 0.0.7
  • @types/node 16.11.6
  • clean-publish 3.4.3
  • conventional-github-releaser 3.1.5
  • copyfiles 2.4.1
  • eslint 7.32.0
  • eslint-import-resolver-typescript 2.5.0
  • lint-staged 11.2.6
  • rimraf 3.0.2
  • simple-git-hooks 2.7.0
  • standard-version 9.3.2
  • typescript 4.4.4
  • vite 2.6.13
  • vite ^2.0.0
  • pnpm 6.20.3

  • Check this box to trigger a request for Renovate to run again on this repository

Add tests

Integration tests should cover most usual cases

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.