2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-20 20:00:33 +03:00

fix(#206): TagNode.create now with null content argument by default (#233)

* fix: TagNode.create with null content by default

* Create five-meals-sing.md

* fix: tests

* fix(preset): types inference

* fix: preset types

* fix: preset types

* fix: lock file, parser and utils

* refactor: move types to separate package

* fix(preset): add @bbob/core to dev deps

* fix(preset): lock file

* test(preset-vue): create tags

* test(preset-vue): tests

* chore(nx): fix nx cover deps

* chore: changesets
This commit is contained in:
Nikolay Kost
2024-06-24 01:32:15 +03:00
committed by GitHub
parent 95d9b8a2ba
commit 270f5645f8
58 changed files with 657 additions and 428 deletions
+2 -1
View File
@@ -10,7 +10,8 @@
],
"dependencies": {
"@bbob/core": "*",
"@bbob/plugin-helper": "*"
"@bbob/plugin-helper": "*",
"@bbob/types": "*"
},
"main": "lib/index.js",
"module": "es/index.js",
+7 -6
View File
@@ -1,14 +1,15 @@
import core, { BBobCoreOptions, BBobPlugins } from '@bbob/core';
import { attrsToString, isTagNode, TagNode, TagNodeTree } from '@bbob/plugin-helper';
import core from '@bbob/core';
import { attrsToString, isTagNode, TagNode } from '@bbob/plugin-helper';
import type { BBobCoreOptions, BBobPlugins, TagNodeTree } from '@bbob/types';
const SELFCLOSE_END_TAG = '/>';
const CLOSE_START_TAG = '</';
const START_TAG = '<';
const END_TAG = '>';
export type BBobHTMLOptions = {
interface BBobHTMLOptions extends BBobCoreOptions {
stripTags?: boolean
} & BBobCoreOptions
}
function renderNode(node?: TagNodeTree, options?: BBobHTMLOptions): string {
const { stripTags = false } = options || {}
@@ -42,8 +43,8 @@ function renderNode(node?: TagNodeTree, options?: BBobHTMLOptions): string {
return '';
}
export function render(nodes: TagNodeTree, options?: BBobHTMLOptions): string {
if (Array.isArray(nodes)) {
export function render(nodes?: TagNodeTree, options?: BBobHTMLOptions): string {
if (nodes && Array.isArray(nodes)) {
return nodes.reduce<string>((r, node) => r + renderNode(node, options), '')
}