mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-20 20:00:33 +03:00
* 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:
@@ -10,7 +10,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@bbob/core": "*",
|
||||
"@bbob/plugin-helper": "*"
|
||||
"@bbob/plugin-helper": "*",
|
||||
"@bbob/types": "*"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
||||
@@ -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), '')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user