npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

deltaconvert

v1.1.2

Published

Convert quill delta to and from other formats

Downloads

28

Readme

deltaconvert

Node.js CI

Convert quill delta objects to and from plain text, HTML, and NPF.

Installation

npm install deltaconvert

Example

const {deltaToHtml} = require('deltaconvert');
deltaToHtml({
    ops: [
        {insert: 'Gandalf', attributes: {bold: true}},
        {insert: ' the '},
        {insert: 'Grey', attributes: {color: '#cccccc'}},
        {insert: '\n'}
    ]
});
/** 
 * Returns
 * <p><b>Gandalf</b> the <span style="color:#cccccc;">Grey</span></p>
 */

Reference

deltaToHtml

Convert a delta object to html. The resulting HTML can be inserted into an existing website, it will have no <html>, <body>, etc. tags. {insert: {divider:true}} objects will be converted to <hr> tags.

deltaToNpf

Convert a delta object to tumblr's NPF format. Headings of level >2 will be converted to bold text. Images will be inserted without any size information. Videos will be inserted as media object if we can guess the mime type from the url, otherwise as plain links. Code blocks will be converted to text objects with subtype chat, which should be rendered with a monospace font.

deltaToText

Convert a delta object to plain text. Formatting, images, etc. will be ignored.

deltaToSsml

Convert a delta object to the Speech Synthesis Markup Language. Images will be converted to elements containing the alt text. Other media and special elements will be ignored.

htmlToDelta

Convert a html document or snippet to a quill delta document. Note that only inline styles are supported. <style> tags and external stylesheets will be ignored. <hr> tags will be converted to {insert: {divider: true}} objects. <iframe>s with the ql-video class will be treated as videos.

npfToDelta

Convert a tumblr NPF to a quill delta. Blog references aren't supported yet.

textToDelta

Convert plain text to a delta object with no formatting information.

htmlToNpf

Convert a html document or snippet to tumblr's NPF format. This is a shorthand for deltaToNpf(htmlToDelta(...)).

npfToHtml

Convert a tumblr NPF to html. This is a shorthand for deltaToNpf(htmlToDelta(...)). Note that blockquotes with indent_level > 1 will be converted to plain <blockquote>s, not nested <blockquote>s. This may change in a future release.

Contributing

If you want to request a feature, report a bug, or contribute in some other way, please file an issue here. Thanks!