https://github.com/tomaskraus/line-block-parser
Recognizes multi-line blocks - such as block comments etc. Simple to use, yet quite powerful.
https://github.com/tomaskraus/line-block-parser
comments ini line parser text
Last synced: 11 months ago
JSON representation
Recognizes multi-line blocks - such as block comments etc. Simple to use, yet quite powerful.
- Host: GitHub
- URL: https://github.com/tomaskraus/line-block-parser
- Owner: tomaskraus
- Created: 2021-03-20T04:36:56.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-11T00:20:45.000Z (about 5 years ago)
- Last Synced: 2025-07-25T01:53:38.499Z (11 months ago)
- Topics: comments, ini, line, parser, text
- Language: JavaScript
- Homepage:
- Size: 210 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Line Block Parser
Recognizes multi-line blocks - such as block comments etc.
Simple to use, yet quite powerful.
## Usage
### Simple example:
```js
const { Parser } = require("line-block-parser");
//we want to recognize lines in javascript block comments
const jsCommentParser = Parser.create("/*", "*/"); //parameters: start tag, end tag
//these are lines to parse
const lines = [
"https://en.wikipedia.org/wiki/Mary_Had_a_Little_Lamb",
"Mary had a little lamb,",
"/*",
" Its fleece was white as snow,",
"And every where that Mary went",
" */",
" The lamb was sure to go ;",
"He followed her to school one day-",
" /* ",
" That was against the rule,",
"*/ ",
"It made the children laugh and play,",
" To see a lamb at school.",
];
//let's go
const blocksFound = jsCommentParser.parseLines(lines);
console.log(blocksFound);
```
Output:
```shell
[
[
' Its fleece was white as snow,',
'And every where that Mary went'
],
[ ' That was against the rule,' ]
]
```