turndown-plugin-confluence-to-gfm

0.5.0 • Public • Published

turndown-plugin-confluence-to-gfm

A Turndown plugin which adds GitHub Flavored Markdown extensions for Confluence pages exported as HTML. It relies on the turndown-plugin-gfm plugin.

This small plugin converts few non-standard features of Confluence HTML content to GFM, namely:

  • Code block (indented and fenced)
  • Tasks list
  • Emoji

Test Page

The test page can be found here.

Installation

npm:

npm install turndown-plugin-confluence-to-gfm

Browser:

<script src="https://unpkg.com/turndown/dist/turndown.js"></script>
<script src="https://unpkg.com/@guyplusplus/turndown-plugin-gfm/dist/turndown-plugin-gfm.js"></script>
<script src="https://unpkg.com/turndown-plugin-confluence-to-gfm/dist/turndown-plugin-confluence-to-gfm.js"></script>

Usage

// For Node.js
var TurndownService = require('turndown')
var TurndownPluginGfmService = require('@guyplusplus/turndown-plugin-gfm')
var TurndownPluginConfluenceToGfmService = require('turndown-plugin-confluence-to-gfm')

var turndownService = new TurndownService()
TurndownPluginGfmService.gfm(turndownService)
TurndownPluginConfluenceToGfmService.confluenceGfm(turndownService)
var markdown = turndownService.turndown('<img class="emoticon emoticon-laugh" data-emoji-id="1f600" data-emoji-shortname=":grinning:" data-emoji-fallback="😀" src="images/icons/emoticons/biggrin.png" width="16" height="16" data-emoticon-name="laugh" alt="(big grin)"/>')

turndown-plugin-confluence-to-gfm is a suite of plugins which can be applied individually. The available plugins are as follows:

  • indentedConfluenceHighlightedCodeBlock and fencedConfluenceHighlightedCodeBlock
  • confluenceEmoji
  • confluenceTaskListItems
  • confluenceGfm (which applies all of the above)

So for example, if you only wish to convert tables:

var confluenceEmoji = require('turndown-plugin-confluence-to-gfm').confluenceEmoji
var turndownService = new TurndownService()
TurndownPluginGfmService.gfm(turndownService)
turndownService.use(confluenceEmoji)

License

turndown-plugin-confluence-to-gfm is copyright © 2021+ Guyplusplus and released under the MIT license.

Package Sidebar

Install

npm i turndown-plugin-confluence-to-gfm

Weekly Downloads

38

Version

0.5.0

License

MIT

Unpacked Size

81.3 kB

Total Files

9

Last publish

Collaborators

  • guyplusplus