Modules@robinpath/html

@robinpath/html

0.1.0Public

Parse, extract, escape, and manipulate HTML content using regex-based processing

@robinpath/html

Parse, extract, escape, and manipulate HTML content using regex-based processing

Category Functions Auth License

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

FunctionDescription
html.stripTagsRemove all HTML tags from a string, returning plain text
html.extractTextExtract the text content of all matching tags by tag name
html.extractLinksExtract all links (href and text) from anchor tags
html.extractImagesExtract all image sources and alt text from img tags
html.getAttributeExtract attribute values from all matching tags
html.escapeHTML-escape special characters (&, <, >, ", ')
html.unescapeReverse HTML escaping (& < > " ')
html.extractMetaExtract meta tag name-content pairs from HTML
html.getTitleExtract the text content of the <title> tag
html.extractTablesExtract HTML tables as arrays of rows and cells
html.wrapWrap text in an HTML tag with optional attributes
html.minifyMinify 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

License

MIT

Versions (1)

VersionTagPublished
0.1.0latestyesterday
Install
$ robinpath install @robinpath/html
Version0.1.0
LicenseMIT
Unpacked Size5.6 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

utilities