0.0.1 • Published 7 years ago

showdown-transform-anchor-href v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

Showdown's transform anchor href extension

Showdown's transform anchor href extension adds support for modifying user provided href.

Working on:

currently only working on node.js

Installation

With npm

npm install showdown-transform-anchor-href

Usage

const Showdown = require('showdown');
const ShowdownTransformAnchorHref = require('showdown-transform-anchor-href');

// setup a transformation function to do whatever you need with the href attr
ShowdownTransformAnchorHref.addTransformation(function(href) {

    return ('http://www.myrwebsite.com/redirect?url='+ new Buffer(href).toString('base64'));
})

showdown.extension('ShowdownTransformAnchorHref', ShowdownTransformAnchorHref);
const converter = new Showdown.Converter({ extensions: ['ShowdownTransformAnchorHref'] });
const input = '[link](example.com)';
const html = converter.makeHtml(input);
console.log(html);