{"id":20368504,"url":"https://github.com/greybax/remark-helpers","last_synced_at":"2025-07-03T06:03:39.146Z","repository":{"id":56609188,"uuid":"63633637","full_name":"greybax/remark-helpers","owner":"greybax","description":"Helper methods for remark","archived":false,"fork":false,"pushed_at":"2020-10-29T00:58:53.000Z","size":18,"stargazers_count":8,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-13T10:04:57.089Z","etag":null,"topics":["ast","helpers","js","js-helpers","js-library","js-tool","markdown","markdown-article","markdown-parser","markdown-to-html","mdast","remark","remark-helpers","remark-plugin","remarkable","remarkjs","remarks"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/greybax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-18T20:09:18.000Z","updated_at":"2024-09-30T21:11:52.000Z","dependencies_parsed_at":"2022-08-15T21:50:43.279Z","dependency_job_id":null,"html_url":"https://github.com/greybax/remark-helpers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/greybax/remark-helpers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greybax%2Fremark-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greybax%2Fremark-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greybax%2Fremark-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greybax%2Fremark-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/greybax","download_url":"https://codeload.github.com/greybax/remark-helpers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greybax%2Fremark-helpers/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263271506,"owners_count":23440396,"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":["ast","helpers","js","js-helpers","js-library","js-tool","markdown","markdown-article","markdown-parser","markdown-to-html","mdast","remark","remark-helpers","remark-plugin","remarkable","remarkjs","remarks"],"created_at":"2024-11-15T00:41:28.968Z","updated_at":"2025-07-03T06:03:39.109Z","avatar_url":"https://github.com/greybax.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# remark-helpers\n\n[![NPM version][npm-image]][npm-url]\n[![Build Status][travis-image]][travis-url]\n[![Coveralls Status][coveralls-image]][coveralls-url]\n[![Dependency Status][depstat-image]][depstat-url]\n[![DevDependency Status][depstat-dev-image]][depstat-dev-url]\n\nBasically, with `remark-helpers` you can find desire elements in markdown document\nand process them in html or plaintext format.\n\nBunch of helpers for working with [remark][remark-readme].\n\nVery important to notice, that this package is very simple and doesn’t contain\nany smart and/or complicated logic, that’s why it’s tightly coupled with\n[remark API for AST tree (MDAST)][remark-readme]. Check it out first.\n\n[remark-readme]: https://github.com/wooorm/remark#readme\n\n## Install\n\n```\nnpm install --save remark-helpers\n```\n\n## Usage\n\n```js\nvar md = require('remark-helpers');\n\nmd.ast('# title');          // mdast format see more https://github.com/wooorm/mdast\nmd.html(`*italic*`);        // \u003cp\u003e\u003cem\u003eitalic\u003c/em\u003e\u003c/p\u003e\nmd.text('**`plaintext`**'); // plaintext\nmd.md(some_mdast_tree);     // markdown text\n```\n\n[Look into tests for more examples](tests).\n\n[tests]: https://github.com/greybax/remark-helpers/blob/master/test.js\n## API\n\n### html(input)\n\nReturn html.\n\n##### input\n\nType: `string` / `AST`\n\n### text(input)\n\nReturn plain text.\n\n##### input\n\nType: `string` / `AST`\n\n### ast(input)\n\nReturn AST tree for current text.\n\n##### input\n\nType: `string`\n\n### md(input)\n\nReturn markdown for current input text.\n\n##### input\n\nType:  `string` / `AST`\n\n\n### Bunch of shortcut helpers. Based on [MDAST](https://github.com/wooorm/mdast)\n\n```js\nconst isType = (node, type) =\u003e node.type === type;\nconst isDepth = (node, depth) =\u003e node.depth === depth;\nconst hasChildren = (node) =\u003e node.children ? true : false;\n\nconst isRoot = node =\u003e isType(node, \"root\");\nconst isParagraph = node =\u003e isType(node, \"paragraph\");\nconst isBlockquote = node =\u003e isType(node, 'blockquote');\nconst isHeading = node =\u003e isType(node, 'heading');\nconst isCode = node =\u003e isType(node, 'code');\nconst isInlineCode = node =\u003e isType(node, 'inlineCode');\nconst isYaml = node =\u003e isType(node, 'yaml');\nconst isHtml = node =\u003e isType(node, 'html');\nconst isList = node =\u003e isType(node, 'list');\nconst isListItem = node =\u003e isType(node, 'listItem');\nconst isTable = node =\u003e isType(node, 'table');\nconst isTableRow = node =\u003e isType(node, 'tableRow');\nconst isTableCell = node =\u003e isType(node, 'tableCell');\nconst isThematicBreak = node =\u003e isType(node, 'thematicBreak');\nconst isBreak = node =\u003e isType(node, 'break');\nconst isEmphasis = node =\u003e isType(node, 'emphasis');\nconst isStrong = node =\u003e isType(node, 'strong');\nconst isDelete = node =\u003e isType(node, 'delete');\nconst isLink = node =\u003e isType(node, 'link');\nconst isImage = node =\u003e isType(node, 'image');\nconst isFootnote = node =\u003e isType(node, 'footnote');\nconst isLinkReference = node =\u003e isType(node, 'linkReference');\nconst isImageReference = node =\u003e isType(node, 'imageReference');\nconst isFootnoteReference = node =\u003e isType(node, 'footnoteReference');\nconst isDefinition = node =\u003e isType(node, 'definition');\nconst isFootnoteDefinition = node =\u003e isType(node, 'footnoteDefinition');\nconst isText = node =\u003e isType(node, 'Text');\n```\n\n## License\n\nMIT © [Aleksandr Filatov](https://alfilatov.com/)\n\n[npm-url]: https://npmjs.org/package/remark-helpers\n[npm-image]: https://img.shields.io/npm/v/remark-helpers.svg?style=flat-square\n\n[travis-url]: https://travis-ci.org/greybax/remark-helpers\n[travis-image]: https://img.shields.io/travis/greybax/remark-helpers.svg?style=flat-square\n\n[coveralls-url]: https://coveralls.io/r/greybax/remark-helpers\n[coveralls-image]: https://img.shields.io/coveralls/greybax/remark-helpers.svg?style=flat-square\n\n[depstat-url]: https://david-dm.org/greybax/remark-helpers\n[depstat-image]: https://david-dm.org/greybax/remark-helpers.svg?style=flat-square\n\n[depstat-dev-url]: https://david-dm.org/greybax/remark-helpers\n[depstat-dev-image]: https://david-dm.org/greybax/remark-helpers/dev-status.svg?style=flat-square","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreybax%2Fremark-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreybax%2Fremark-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreybax%2Fremark-helpers/lists"}