Zero-dependency multiline string template.
npm install mlstr
or
yarn add mlstr
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)
MIT (see LICENSE.md file for details)