1.0.5 • Published 3 years ago

better-codeblock v1.0.5

Weekly downloads
15
License
MIT
Repository
github
Last release
3 years ago

Example

npm.io

Docs

Class Codeblock

code(content)

Set the content of the code block

ParamType
contentstring

Example

new Codeblock(Language.JAVASCRIPT)
  .code('console.log("Hello, world!")')
  ...

importCode(url)

Import the content of the code block

ParamTypeDescription
urlstringURL or path to the file. If using path, must use absolute path.

applyTheme(name)

Apply the theme from default prism themes. See: https://github.com/PrismJS/prism/tree/master/themes

ParamType
namestring

Example

prism-coy.css -> "coy"

applyOriginalTheme(url)

Create your own using based on the default themes. See: https://github.com/PrismJS/prism/tree/master/themes

ParamType
urlstring

save(writeStream)

Save the code block.

ParamType
writeStreamWriteStream