2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-11 18:02:26 +03:00

feat(#250): introduce caseFreeTags option (#251)

* chore: initial tests

* feat: parser test

* feat: add case free tags support

* fix: coverage upload

* fix: --disable=gcov

* fix: npm publish sha commit

* fix: change codecov to coveralls

* fix: change workflow pr build and publish

* chore: change coverage badge [skip ci]
This commit is contained in:
Nikolay Kost
2024-10-17 00:26:06 +03:00
committed by GitHub
parent 99c629e666
commit ccab54a454
12 changed files with 293 additions and 160 deletions
+25 -3
View File
@@ -8,9 +8,9 @@ written in pure javascript, no dependencies
[![Tests](https://github.com/JiLiZART/BBob/actions/workflows/test.yml/badge.svg)](https://github.com/JiLiZART/BBob/actions/workflows/test.yml)
[![Benchmark](https://github.com/JiLiZART/BBob/actions/workflows/benchmark.yml/badge.svg)](https://github.com/JiLiZART/BBob/actions/workflows/benchmark.yml)
<a href="https://codecov.io/gh/JiLiZART/bbob">
<img src="https://codecov.io/gh/JiLiZART/bbob/branch/master/graph/badge.svg" alt="codecov">
</a>
<a href='https://coveralls.io/github/JiLiZART/BBob?branch=master'>
<img src='https://coveralls.io/repos/github/JiLiZART/BBob/badge.svg?branch=master' alt='Coverage Status' />
</a>
<a href="https://www.codefactor.io/repository/github/jilizart/bbob">
<img src="https://www.codefactor.io/repository/github/jilizart/bbob/badge" alt="CodeFactor">
</a>
@@ -230,6 +230,28 @@ const processed = bbobHTML(`[b]Text[/b]'\\[b\\]Text\\[/b\\]'`, presetHTML5(), {
console.log(processed); // <span style="font-weight: bold;">Text</span>[b]Text[/b]
```
#### caseFreeTags
Allows to parse case insensitive tags like `[h1]some[/H1]` -> `<h1>some</h1>`
```js
import bbobHTML from '@bbob/html'
import presetHTML5 from '@bbob/preset-html5'
const processed = bbobHTML(`[h1]some[/H1]`, presetHTML5(), { caseFreeTags: true })
console.log(processed); // <h1>some</h1>
```
```js
import bbobHTML from '@bbob/html'
import presetHTML5 from '@bbob/preset-html5'
const processed = bbobHTML(`[b]Text[/b]'\\[b\\]Text\\[/b\\]'`, presetHTML5(), { enableEscapeTags: true })
console.log(processed); // <span style="font-weight: bold;">Text</span>[b]Text[/b]
```
### Presets <a name="basic"></a>