mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-17 19:21:20 +03:00
chore(readme): update @bbob/html usage example
This commit is contained in:
@@ -74,13 +74,12 @@ npm i @bbob/core @bbob/html @bbob/preset-html5
|
|||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import bbob from '@bbob/core'
|
import bbobHTML from '@bbob/html'
|
||||||
import { render } from '@bbob/html'
|
|
||||||
import presetHTML5 from '@bbob/preset-html5'
|
import presetHTML5 from '@bbob/preset-html5'
|
||||||
|
|
||||||
const processed = bbob(presetHTML5()).process(`[i]Text[/i]`, { render })
|
const processed = bbobHTML(`[i]Text[/i]`, presetHTML5())
|
||||||
|
|
||||||
console.log(processed.html); // <span style="font-style: italic;">Text</span>
|
console.log(processed); // <span style="font-style: italic;">Text</span>
|
||||||
```
|
```
|
||||||
|
|
||||||
### React usage <a name="react-usage"></a>
|
### React usage <a name="react-usage"></a>
|
||||||
@@ -108,9 +107,9 @@ Its a way to transform parsed BBCode AST tree to another tree by rules in preset
|
|||||||
import { createPreset } from '@bbob/preset'
|
import { createPreset } from '@bbob/preset'
|
||||||
|
|
||||||
export default createPreset({
|
export default createPreset({
|
||||||
quote: node => ({
|
quote: (node) => ({
|
||||||
tag: 'blockquote',
|
tag: 'blockquote',
|
||||||
attrs: {},
|
attrs: node.attrs,
|
||||||
content: [{
|
content: [{
|
||||||
tag: 'p',
|
tag: 'p',
|
||||||
attrs: {},
|
attrs: {},
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"size": "lerna run --parallel bundlesize",
|
"size": "lerna run --parallel bundlesize",
|
||||||
"test": "lerna run --parallel build && lerna run link && lerna run --parallel test && lerna run --parallel size",
|
"test": "lerna run --parallel build && lerna run link && lerna run --parallel test && lerna run --parallel size",
|
||||||
"cover": "lerna run --parallel cover",
|
"cover": "lerna run --parallel cover",
|
||||||
|
"build": "lerna run --parallel build",
|
||||||
"lint": "lerna run --parallel build && lerna run --parallel link && lerna run --parallel lint"
|
"lint": "lerna run --parallel build && lerna run --parallel link && lerna run --parallel lint"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
|
|||||||
Reference in New Issue
Block a user