mlstr
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

mlstr

Zero-dependency multiline string template.

Intallation

npm install mlstr

or

yarn add mlstr

Usage

First, import or require the lib:

const mlstr = require('mlstr');

// or

import mlstr from 'mlstr';

Then just add the mlstr tag in front of a string template with multiple lines to compact it into a plain string. Line breaks in the string template are replaced by spaces.

Example:

const mystring = mlstr`
        The string can have many
        lines but the output will
        be plain text.

        Leave one line empty to
        create actual line breaks
        in the string output.
        (similar to markdown)
    `;

console.log(mystring);

The code above outputs this:

The string can have many lines but the output will be plain text.
Leave one line empty to create actual line breaks in the string output. (similar to markdown)

LICENSE

MIT (see LICENSE.md file for details)

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i mlstr

      Weekly Downloads

      0

      Version

      1.0.3

      License

      MIT

      Unpacked Size

      3.06 kB

      Total Files

      5

      Last publish

      Collaborators

      • leonardoraele