lykken / html-to-schibsted-markup

Converts html input to a Schibsted markup object.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

html-to-schibsted-markup

The html-to-schibsted-markup module will try to create a Schibsted markup object from a HTML fragment.

Install

npm i html-to-schibsted-markup

Usage

const converter = require('html-to-schibsted-markup');
const obj = converter(
  'Try <a href="mailto:julenissen@nordpolen.no">sending an email to Santa Claus</a> if you like!';
);

obj should now be as follows:

{
  value: "Try sending an email to Santa Claus if you like!",
  markup: [
    {
      type: "link:external",
      offset: 4,
      length: 31,
      uri: "mailto:julenissen@nordpolen.no",
    },
  ],
}

Contributing

PRs accepted.

License

MIT © Fædrelandsvennen

About

Converts html input to a Schibsted markup object.

License:MIT License


Languages

Language:JavaScript 100.0%