{"id":23078039,"url":"https://github.com/webmasterish/first-x","last_synced_at":"2025-07-11T00:04:44.746Z","repository":{"id":57236939,"uuid":"166161654","full_name":"webmasterish/first-x","owner":"webmasterish","description":"Utility to extract the content of the first occurence of element x from HTML or Markdown","archived":false,"fork":false,"pushed_at":"2019-01-18T04:51:47.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-29T09:05:06.013Z","etag":null,"topics":["blockquote","content","extract","header","html","image","markdow","paragraph","regex","utility"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webmasterish.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-17T04:44:36.000Z","updated_at":"2022-03-06T03:57:35.000Z","dependencies_parsed_at":"2022-08-26T14:04:13.430Z","dependency_job_id":null,"html_url":"https://github.com/webmasterish/first-x","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/webmasterish/first-x","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmasterish%2Ffirst-x","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmasterish%2Ffirst-x/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmasterish%2Ffirst-x/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmasterish%2Ffirst-x/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webmasterish","download_url":"https://codeload.github.com/webmasterish/first-x/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmasterish%2Ffirst-x/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264696158,"owners_count":23650933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockquote","content","extract","header","html","image","markdow","paragraph","regex","utility"],"created_at":"2024-12-16T10:46:18.026Z","updated_at":"2025-07-11T00:04:44.624Z","avatar_url":"https://github.com/webmasterish.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# First x\n\n\u003e Utility to extract the content of the first occurence of element x from HTML or Markdown\n\n[![Build Status](https://img.shields.io/travis/webmasterish/first-x/master.svg?style=flat-square)](https://travis-ci.org/webmasterish/first-x)\n[![npm version](https://img.shields.io/npm/v/first-x.svg?style=flat-square)](http://npm.im/first-x)\n[![Greenkeeper badge](https://badges.greenkeeper.io/webmasterish/first-x.svg?style=flat-square)](https://greenkeeper.io/)\n[![MIT License](https://img.shields.io/npm/l/express.svg?style=flat-square)](http://opensource.org/licenses/MIT)\n\n\n## Install\n\n\n```sh\n$ npm install first-x\n\n# or\n\n$ yarn add -D first-x\n```\n\n\n## Usage\n\n\nThe following `HTML` and `markdown` elements/syntaxt are supported \nusing relevant functions:\n\n- `HTML` header tags (`h1`, `h2`, `h3`, etc...) and their `markdown` counterparts\n- `HTML` image tag (`img`) and it's `markdown` counterpart\n- `HTML` paragraph tag (`p`) and it's `markdown` counterpart\n- `HTML` blockquote tag (`blockquote`) and it's `markdown` counterpart\n\n\nAll supported elements/syntaxt have the following functions available:\n\n- `from_any` - extracts content from first found occurence regardless of syntax\n- `from_html` - exclusively checks `html`\n- `from_md` (alias of `from_markdown`) - exclusively checks `markdown`\n\nMore details in [`Extractor class`](lib/Extractor.js).\n\n\n```js\nconst FIRST = require('first-x');\n\n// -----------------------------------------------------------------------------\n\n// get first header text from some content\n\nconst title = FIRST.header.from_any( content );\n\n// -----------------------------------------------------------------------------\n\n// extract paragraph content exclusively from markdown\n\nconst description = FIRST.p.from_md( content );\n\n// -----------------------------------------------------------------------------\n\n// extract image url exclusively from html\n\nconst img_url = FIRST.img.from_html( content );\n\n// -----------------------------------------------------------------------------\n\n// get first found blockquote content\n\nconst quote = FIRST.blockquote.from_any( content );\n\n```\n\n## License\n\nMIT © [webmasterish](https://webmasterish.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebmasterish%2Ffirst-x","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebmasterish%2Ffirst-x","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebmasterish%2Ffirst-x/lists"}