Docute Iframe banner
egoist egoist

Docute Iframe

Development community

Description

A docute plugin to run code in docs with an iframe.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

docute-iframe

[![NPM version](https://img.shields.io/npm/v/docute-iframe.svg?style=flat)](https://npmjs.com/package/docute-iframe) [![NPM downloads](https://img.shields.io/npm/dm/docute-iframe.svg?style=flat)](https://npmjs.com/package/docute-iframe) [![Build Status](https://img.shields.io/circleci/project/egoist/docute-iframe/master.svg?style=flat)](https://circleci.com/gh/egoist/docute-iframe) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/egoist/donate)

A docute plugin to run code in docs with an iframe.

Usage

*This plugin requires docute^2.9.0*

Include the scripts before running `docute.init`:

Then activate the plugin:

docute.init({
  plugins: [
    docuteIframe()
  ]
})

Finally, you can write some fancy code examples which are `runnable`:

This is a **markdown** file, here it to demonstrate some code:

````html
document.getElementById('example').innerHTML = 'it works' ````

**Note:** It's similar to gfm code blocks, which use triple backticks, but here you need to use **4 backticks** to mark it as runnable code while still have syntax highlight in your editor.

If the `language` of code block is `js` or `javascript`, it will be automatically wrapped in `` tag and inserted into iframe body, you can [customize it](#parsecontent) though.

API

docuteIframe([options])

options

match

Type: `RegExp`
Default: /^\`{4}(.\*?)[\n\r]+([\s\S]\*?)[\n\r]+\`{4}/gm

The regular expression we use to find runnable code.

showSourceCode

Type: `boolean`
Default: `true`

Show highlighted source code before iframe.

prepend

Type: `string`

Prepend string to iframe body, eg:

docuteIframe({
  prepend: ''
})