
Product
Rubygems Ecosystem Support Now Generally Available
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.
Utility to extract the content of the first occurence of element x from HTML or Markdown
Utility to extract the content of the first occurence of element x from HTML or Markdown
$ npm install first-x
# or
$ yarn add -D first-x
The following HTML
and markdown
elements/syntaxt are supported
using relevant functions:
HTML
header tags (h1
, h2
, h3
, etc...) and their markdown
counterpartsHTML
image tag (img
) and it's markdown
counterpartHTML
paragraph tag (p
) and it's markdown
counterpartHTML
blockquote tag (blockquote
) and it's markdown
counterpartAll supported elements/syntaxt have the following functions available:
from_any
- extracts content from first found occurence regardless of syntaxfrom_html
- exclusively checks html
from_md
(alias of from_markdown
) - exclusively checks markdown
More details in Extractor class
.
const FIRST = require('first-x');
// -----------------------------------------------------------------------------
// get first header text from some content
const title = FIRST.header.from_any( content );
// -----------------------------------------------------------------------------
// extract paragraph content exclusively from markdown
const description = FIRST.p.from_md( content );
// -----------------------------------------------------------------------------
// extract image url exclusively from html
const img_url = FIRST.img.from_html( content );
// -----------------------------------------------------------------------------
// get first found blockquote content
const quote = FIRST.blockquote.from_any( content );
MIT © webmasterish
FAQs
Utility to extract the content of the first occurence of element x from HTML or Markdown
The npm package first-x receives a total of 2 weekly downloads. As such, first-x popularity was classified as not popular.
We found that first-x demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.
Research
The Socket Research Team investigates a malicious npm package that appears to be an Advcash integration but triggers a reverse shell during payment success, targeting servers handling transactions.
Security Fundamentals
The Socket Threat Research Team uncovers how threat actors weaponize shell techniques across npm, PyPI, and Go ecosystems to maintain persistence and exfiltrate data.