Socket
Socket
Sign inDemoInstall

shortcode-tree

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shortcode-tree - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

src/shortcode-formatter.js

0

index.js
module.exports.default = require('./src/index');

2

package.json
{
"name": "shortcode-tree",
"version": "1.1.1",
"version": "1.2.0",
"description": "Parser library for reading short codes (BB codes) into a tree structure",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -32,2 +32,3 @@ # shortcode-tree

- Supports tag properties (with or without string literals)
- Stringify `Shortcode` objects to shortcode text

@@ -55,5 +56,5 @@ ## Installation

A shortcode node contains the following properties:
A shortcode node contains the following fields:
| Property | Type | Description |
| Field | Type | Description |
| --- | --- | --- |

@@ -66,5 +67,7 @@ | `text` | string | The raw text content (code) of this node. |

A parsed shortcode. Typically available through the `shortcode` property of a shortcode node.
A parsed shortcode. Typically available through the `shortcode` field of a shortcode node.
| Property | Type | Description |
#### Fields
| Field | Type | Description |
| --- | --- | --- |

@@ -76,4 +79,13 @@ | `name` | string | Tag name |

| `codeText` | string | The raw shortcode text, as it was parsed. |
| `offset` | integer | Offset index, relative to the original input string. |
| `offset` | integer | Offset index, relative to the original input string. |
#### Methods
| Signature | Returns | Description |
| --- | --- | --- |
| `stringify()` | string | Formats the data in the `Shortcode` object to shortcode text |
| `hasProperty([string] key)` | boolean | Gets whether property with name `key` exists. |
| `getProperty([string] key)` | value or null | Gets value of property with name `key`, or NULL if not set. |
| `setProperty([string] key, value)` | void | Add or update property with given key and value. |
### The `TextNode` object

@@ -83,3 +95,3 @@

| Property | Type | Description |
| Field | Type | Description |
| --- | --- | --- |

@@ -86,0 +98,0 @@ | `text` | string | Raw text or code |

@@ -5,2 +5,3 @@ module.exports = {

"ShortcodeExtractor": require('./shortcode-extractor'),
"ShortcodeFormatter": require('./shortcode-formatter'),
"Shortcode": require('./shortcode'),

@@ -7,0 +8,0 @@ "ShortcodeNode": require('./shortcode-node'),

@@ -0,0 +0,0 @@ let ShortcodeParser = require('./shortcode-parser');

@@ -0,0 +0,0 @@ let Shortcode = require('./shortcode');

@@ -0,0 +0,0 @@ let Shortcode = require('./shortcode');

@@ -0,0 +0,0 @@ let ShortcodeExtractor = require('./shortcode-extractor');

@@ -0,1 +1,3 @@

let ShortcodeFormatter = require('./shortcode-formatter');
class Shortcode {

@@ -26,4 +28,12 @@ constructor (name, content, properties, isSelfClosing, codeText, offset) {

}
stringify() {
return ShortcodeFormatter.stringify(this);
}
toString() {
return this.stringify();
}
}
module.exports = Shortcode;

@@ -0,0 +0,0 @@ class TextNode {

@@ -0,0 +0,0 @@ let ShortcodeExtractor = require('../src').ShortcodeExtractor;

@@ -0,0 +0,0 @@ let ShortcodeParser = require('../src').ShortcodeParser;

@@ -0,0 +0,0 @@ let ShortcodeTree = require('../src').ShortcodeTree;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc