montag

format multiline strings using tagged templates, instead of putting all lines into an array and joining to a string

MIT 6 个版本
安装
npm install montag
yarn add montag
pnpm add montag
bun add montag
README

Montag License NPM version Build Status Coverage

“If you don’t want a house built, hide the nails and wood. If you don’t want a man unhappy politically, don’t give him two sides to a question to worry him; give him one. Better yet, give him none.”

(c) Ray Bradbury "Fahrenheit 451"

Format multiline strings using tagged templates, instead of putting all lines into an array and joining to a string. Use @putout/plugin-montag to convert existing code to montag.

Install

npm i montag

How to use?

import {montag} from 'montag';

const str1 = montag`
    if (a > b)
        console.log(c);
`;

const str2 = [
    'if (a > b)',
    '    console.log(c)',
].join('\n');

str1 === str2;
// returns
true;

License

MIT

版本列表
2.0.1 2026-04-21
2.0.0 2026-04-21
1.2.1 2021-08-16
1.2.0 2021-01-21
1.1.0 2020-12-24
1.0.0 2020-05-07