1.0.6 • Published 1 month ago

@taga3s/highlightjs-terraform v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Highlightjs-Terraform (maintained fork)

npm version

This is a maintained fork of https://github.com/highlightjs/highlightjs-terraform. I started this fork because the original repository was not being maintained for a long time, but it is still a very useful library for syntax highlighting Terraform code in web applications using Highlight.js.

Usage

  1. Install with npm, pnpm, or yarn:
$ npm install @taga3s/highlightjs-terraform
  1. Use .css files of highlight.js in your project

Example

  • Using with rehype plugins
import rehypeHighlight from 'rehype-highlight'
import rehypeParse from 'rehype-parse'
import rehypeStringify from 'rehype-stringify'
import { common } from 'lowlight'
import { definer } from '@taga3s/highlightjs-terraform'
import { read } from 'to-vfile'
import { unified } from 'unified'

const file = await read('example.html')

await unified()
  .use(rehypeParse)
  .use(rehypeHighlight, {
      languages: { ...common, tf: definer },
      detect: true,
  })
  .use(rehypeStringify)
  .process(file)

console.log(String(file))

License

MIT

1.0.6

1 month ago

1.0.5

2 months ago

1.0.4

2 months ago

1.0.3

2 months ago

1.0.2

2 months ago

1.0.1

2 months ago

1.0.0

2 months ago