https://github.com/danieldietrich/rich-string
A tag function that automatically aligns embedded multiline strings.
https://github.com/danieldietrich/rich-string
Last synced: 24 days ago
JSON representation
A tag function that automatically aligns embedded multiline strings.
- Host: GitHub
- URL: https://github.com/danieldietrich/rich-string
- Owner: danieldietrich
- License: mit
- Created: 2019-09-13T17:51:09.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-16T06:02:17.000Z (over 2 years ago)
- Last Synced: 2025-06-07T02:49:20.229Z (about 1 month ago)
- Language: JavaScript
- Size: 861 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/@danieldietrich/rich-string/)[](https://snyk.io/test/npm/@danieldietrich/rich-string)[](https://bundlephobia.com/result?p=@danieldietrich/rich-string@latest)
[](https://travis-ci.org/danieldietrich/rich-string/)[](https://codecov.io/gh/danieldietrich/rich-string/)

[](https://github.com/sponsors/danieldietrich)[](https://paypal.me/danieldietrich13)[](https://opensource.org/licenses/MIT/)
[](https://twitter.com/danieldietrich/)# rich-string
A tag function that automatically aligns embedded multiline strings.
## Installation
```bash
npm i @danieldietrich/rich-string
```## Usage
The module supports ES6 _import_ and CommonJS _require_ style.
```ts
import s from '@danieldietrich/rich-string';/*
function sayHi(name) {
console.log('Hi ${name}, I hope you are doing well!');
}
*/
const res = generateSayHi(s`console.log('Hi \${name}, I hope you are doing well!');
`);
function generateSayHi(body: string): string {
return s`
function sayHi(name) {
${body}
}
`;
}
```---
Copyright © 2020 by [Daniel Dietrich]([email protected]). Released under the [MIT](https://opensource.org/licenses/MIT/) license.