Modules@robinpath/html
@robinpath/html
0.1.0PublicParse, extract, escape, and manipulate HTML content using regex-based processing
@robinpath/html
Parse, extract, escape, and manipulate HTML content using regex-based processing
Why use this module?
The html module lets you:
- Remove all HTML tags from a string, returning plain text
- Extract the text content of all matching tags by tag name
- Extract all links (href and text) from anchor tags
- Extract all image sources and alt text from img tags
- Extract attribute values from all matching tags
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/html
Quick Start
No credentials needed — start using it right away:
html.extractText "<p>One</p><p>Two</p>" "p"
Available Functions
| Function | Description |
|---|---|
html.stripTags | Remove all HTML tags from a string, returning plain text |
html.extractText | Extract the text content of all matching tags by tag name |
html.extractLinks | Extract all links (href and text) from anchor tags |
html.extractImages | Extract all image sources and alt text from img tags |
html.getAttribute | Extract attribute values from all matching tags |
html.escape | HTML-escape special characters (&, <, >, ", ') |
html.unescape | Reverse HTML escaping (& < > " ') |
html.extractMeta | Extract meta tag name-content pairs from HTML |
html.getTitle | Extract the text content of the <title> tag |
html.extractTables | Extract HTML tables as arrays of rows and cells |
html.wrap | Wrap text in an HTML tag with optional attributes |
html.minify | Minify HTML by removing extra whitespace and newlines between tags |
Examples
Extract the text content of all matching tags by tag name
html.extractText "<p>One</p><p>Two</p>" "p"
Extract all links (href and text) from anchor tags
html.extractLinks "<a href=\"https://example.com\">Example</a>"
Extract all image sources and alt text from img tags
html.extractImages "<img src=\"photo.jpg\" alt=\"A photo\">"
Integration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/html";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
html.extractText "<p>One</p><p>Two</p>" "p"
`);
Full API Reference
See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.
Related Modules
@robinpath/json— JSON module for complementary functionality
License
MIT
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.0 | latest | yesterday |
Related Modules
utilities
1
@dev-tester/hello-world
v2.0.0dev-tester
Updated description
0 downloads
...
utilities
0
@robinpath/apollo
v0.1.1robinpath
Apollo module for RobinPath.
0 downloads
...
utilities
0
@robinpath/archive
v0.1.1robinpath
Create and extract .zip and .tar.gz file archives
0 downloads
...
utilities
0
@robinpath/assert
v0.1.1robinpath
Testing assertions: equal, deepEqual, truthy, falsy, type checks, includes, matches, throws, and more
0 downloads
...
Install
$ robinpath install @robinpath/html Version0.1.0
LicenseMIT
Unpacked Size5.6 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

