Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

styles-to-text

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

styles-to-text

Tiny package for styling text by using javascript style definitions. Commonly used for handling texts of content management systems like takeshape, graphcms and other.

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Javascript Styles to Text

A small module for styling text with html by using arrays of text style definitions. Commonly necessary for parsing text blocks from content management systems like Takeshape.io and other cm-systems.

Install

npm i styles-to-text
# or
yarn styles-to-text

Usage

import stylesToText from "styles-to-text";

const textToStyle = `To be, or not to be, that is the question.`;

const styleDefinitions = [  {
    offset: 0,
    length: 20,
    style: "BOLD"
}, {
    offset: 3,
    length: 17,
    style: "STRIKE"
}, {
    offset: 14,
    length: 15,
    style: "UNDERLINE"
}  ];

console.log(stylesToText(textToStyle, styleDefinitions));

Keywords

FAQs

Package last updated on 26 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc