@oliveryasuna/code-block

1.0.4 • Public • Published

<code-block>

A web component using Prism.

Getting Started

Without any attributes, the language will default to clike and theme to prism.

<code-block></code-block>

<script>
    document.querySelector('code-block').code = `function print(msg) {
  console.log(msg);
}

print('Hello, World!');`;
</script>

You can specify the language and theme with the language and theme attributes, respectively.

<code-block language="java" theme="prism-tomorrow"></code-block>

If you want to remove the theme's background graphics, use the plain attribute.

<code-block plain></code-block>

License

This code is under the BSD 3-Clause.

Sponsoring

If you like my work and want to support it, please consider sponsoring me. It's how I make the time to code great things!

Package Sidebar

Install

npm i @oliveryasuna/code-block

Weekly Downloads

2

Version

1.0.4

License

BSD-3-Clause

Unpacked Size

41.8 kB

Total Files

13

Last publish

Collaborators

  • oliveryasuna