https://github.com/rumkin/tc39-proposal-block-string
Block string
https://github.com/rumkin/tc39-proposal-block-string
Last synced: 4 months ago
JSON representation
Block string
- Host: GitHub
- URL: https://github.com/rumkin/tc39-proposal-block-string
- Owner: rumkin
- Created: 2016-11-13T20:21:01.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-13T20:44:27.000Z (over 9 years ago)
- Last Synced: 2025-03-25T01:42:14.016Z (about 1 year ago)
- Size: 1000 Bytes
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Block String
Add support of indentation string block to allow use a large block of strings into
the code without troubles with indentation.
Example:
```
let markdownString = @
There is a __string__ with several paragraphs
Without quote escaping and so
let ymlString = @
base: element
items:
- item 1
- item 2
let htmlString = @
Good news everyone!
console.log(htmlString); // => "Good news everyone!
"
let page = 'Main';
let jadeTemplate = jade(@@ // with js placeholders
html
head
title ${page}
body
h1 Page
p Hi block text
);
```
This allow to avoid mess of quotation escaping and indentation for multiline strings.
So it allow to insert any other text inside js. Even js itself. Such string should get the first line
indentation and cut it from start of each following line.