From 7a52ddeba2a68388b544f529d2d92104420f77b0 Mon Sep 17 00:00:00 2001 From: Shipwreckt Date: Fri, 31 Oct 2025 20:02:14 +0000 Subject: Changed from static to 11ty! --- node_modules/posthtml-render/readme.md | 225 +++++++++++++++++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 node_modules/posthtml-render/readme.md (limited to 'node_modules/posthtml-render/readme.md') diff --git a/node_modules/posthtml-render/readme.md b/node_modules/posthtml-render/readme.md new file mode 100644 index 0000000..066f37d --- /dev/null +++ b/node_modules/posthtml-render/readme.md @@ -0,0 +1,225 @@ +[![npm][npm]][npm-url] +[![node]]() +[![tests][tests]][tests-url] +[![coverage][cover]][cover-url] + +
+ + PostHTML + +

PostHTML Render

+

Renders a PostHTML Tree to HTML/XML

+
+ +

Install

+ +```bash +npm i -D posthtml-render +``` + +

Usage

+ +### `NodeJS` + +```js +import { render } from ''posthtml-render; + +const tree = []; + +const node = {}; + +node.tag = 'ul'; +node.attrs = { class: 'list' }; +node.content = [ + 'one', + 'two', + 'three' +].map((content) => ({ tag: 'li', content })); + +tree.push(node); + +const html = render(tree, options); + +``` + +```html + +``` + +

Options

+ +|Name|Type|Default|Description| +|:--:|:--:|:-----:|:----------| +|**[`singleTags`](#singletags)**|`{Array}`|`[]`|Specify custom single tags (self closing)| +|**[`closingSingleTag`](#closingSingleTag)**|`{String}`|[`>`](#default)|Specify the single tag closing format| +|**[`quoteAllAttributes`](#quoteAllAttributes)**|`{Boolean}`|[`true`](#default)|Put double quotes around all tags, even when not necessary.| +|**[`replaceQuote`](#replaceQuote)**|`{Boolean}`|[`true`](#default)|Replaces quotes in attribute values with `"e;`.| +|**[`quoteStyle`](#quoteStyle)**|`{0 or 1 or 2}`|[`2`](#default)|Specify the style of quote arround the attribute values| + +### `singleTags` + +Specify custom single tags (self closing) + +### `{String}` + +```js +const render = require('posthtml-render') + +const tree = [ { tag: 'name' } ] +const options = { singleTags: [ 'name' ] } + +const html = render(tree, options) +``` + +**result.html** +```html + +``` + +#### `{RegExp}` + +```js +const render = require('posthtml-render') + +const tree = [ { tag: '%=title%' } ] +const options = { singleTags: [ /^%.*%$/ ] } + +const html = render(tree, options) +``` + +**result.html** +```html +<%=title%> +``` + +### `closingSingleTag` + +Specify the single tag closing format + +#### `Formats` + +```js +const render = require('posthtml-render') + +const tree = [ { tag: 'img' } ] +``` + +##### `'tag'` + +```js +const html = render(tree, { closingSingleTag: 'tag' }) +``` + +```html + +``` + +##### `'slash'` + +```js +const html = render(tree, { closingSingleTag: 'slash' }) +``` + +```html + +``` + +##### `'default' (Default)` + +```js +const html = render(tree) +``` + +```html + +``` + +##### `'closeAs'` + +```js +const tree = [ { + tag: 'custom', + closeAs: 'default' // Available types: `tag` | `slash` | `default` +} ] +const html = render(tree, { closingSingleTag: 'closeAs' }) +``` + +```html + +``` + +### `quoteAllAttributes` + +Specify if all attributes should be quoted. + +##### `true (Default)` + +```html + +``` + +##### `false` + +```html + +``` + +### `replaceQuote` + +Replaces quotes in attribute values with `"e;`. + +##### `true (Default)` + +```html + +``` + +##### `false` + +```html +"> +``` + +### `quoteStyle` + +##### `2 (Default)` + +Attribute values are wrapped in double quotes: + +```html + +``` + +##### `1` + +Attribute values are wrapped in single quote: + +```html + +``` + +##### `0` + +Quote style is based on attribute values (an alternative for `replaceQuote` option): + +```html + +``` + + +[npm]: https://img.shields.io/npm/v/posthtml-render.svg +[npm-url]: https://npmjs.com/package/posthtml-render + +[node]: https://img.shields.io/node/v/posthtml-render.svg +[node-url]: https://img.shields.io/node/v/posthtml-render.svg + +[tests]: http://img.shields.io/travis/posthtml/posthtml-render.svg +[tests-url]: https://travis-ci.org/posthtml/posthtml-render + +[cover]: https://coveralls.io/repos/github/posthtml/posthtml-render/badge.svg +[cover-url]: https://coveralls.io/github/posthtml/posthtml-render -- cgit v1.2.3