{"id":19607884,"url":"https://github.com/mkdoc/mkfilter","last_synced_at":"2025-09-15T23:30:45.157Z","repository":{"id":57298928,"uuid":"54308643","full_name":"mkdoc/mkfilter","owner":"mkdoc","description":"Filter nodes by type","archived":false,"fork":false,"pushed_at":"2016-04-18T02:10:18.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-11T18:12:09.407Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkdoc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-20T08:55:19.000Z","updated_at":"2016-03-20T08:55:48.000Z","dependencies_parsed_at":"2022-08-26T18:12:40.300Z","dependency_job_id":null,"html_url":"https://github.com/mkdoc/mkfilter","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkdoc%2Fmkfilter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkdoc%2Fmkfilter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkdoc%2Fmkfilter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkdoc%2Fmkfilter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkdoc","download_url":"https://codeload.github.com/mkdoc/mkfilter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233165115,"owners_count":18634870,"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":[],"created_at":"2024-11-11T10:12:51.832Z","updated_at":"2025-09-15T23:30:39.797Z","avatar_url":"https://github.com/mkdoc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Filter\n\n[![Build Status](https://travis-ci.org/mkdoc/mkfilter.svg?v=3)](https://travis-ci.org/mkdoc/mkfilter)\n[![npm version](http://img.shields.io/npm/v/mkfilter.svg?v=3)](https://npmjs.org/package/mkfilter)\n[![Coverage Status](https://coveralls.io/repos/mkdoc/mkfilter/badge.svg?branch=master\u0026service=github\u0026v=3)](https://coveralls.io/github/mkdoc/mkfilter?branch=master)\n\n\u003e Filter nodes by type\n\nTakes a map of filter flags and removes the matched types from the stream.\n\n## Install\n\n```\nnpm i mkfilter --save\n```\n\nFor the command line interface install [mkdoc][] globally (`npm i -g mkdoc`).\n\n---\n\n- [Install](#install)\n- [Usage](#usage)\n- [Example](#example)\n- [Help](#help)\n- [API](#api)\n  - [filter](#filter)\n    - [Options](#options)\n- [License](#license)\n\n---\n\n## Usage\n\nCreate the stream and write a [commonmark][] document:\n\n```javascript\nvar filter = require('mkfilter')\n  , ast = require('mkast');\nast.src('## Heading\\n\\nParagraph.')\n  .pipe(filter({heading: true}))\n  .pipe(ast.stringify({indent: 0}))\n  .pipe(process.stdout);\n```\n\n## Example\n\nRemove all headings from a document:\n\n```shell\nmkcat README.md | mkfilter --heading | mkout\n```\n\nRemove everything but headings and text from a document:\n\n```shell\nmkcat README.md | mkfilter --heading --text --invert | mkout\n```\n\nPrint code blocks in a document:\n\n```shell\nmkcat README.md | mkfilter --code-block --invert | mkout\n```\n\nBe careful with inline elements, if the parent element is filtered out they are not included:\n\n```shell\nmkcat README.md | mkfilter --link --invert | mkout\n```\n\nBut if you add a block level element to the filter:\n\n```shell\nmkcat README.md | mkfilter --link --paragraph --invert | mkout\n```\n\nThey will be included in the output.\n\n## Help\n\n```\nUsage: mkfilter [options]\n\n  Filter nodes by type.\n\nOptions\n  -i, --invert            Invert the filter\n  --document              Filter document nodes\n  --softbreak             Filter softbreak nodes\n  --linebreak             Filter linebreak nodes\n  --list                  Filter list nodes\n  --item                  Filter item nodes\n  --paragraph             Filter paragraph nodes\n  --text                  Filter text nodes\n  --heading               Filter heading nodes\n  --emph                  Filter emph nodes\n  --strong                Filter strong nodes\n  --link                  Filter link nodes\n  --image                 Filter image nodes\n  --code                  Filter code nodes\n  --code-block            Filter code block nodes\n  --block-quote           Filter block quote nodes\n  --thematic-break        Filter thematic break nodes\n  --html-inline           Filter html inline nodes\n  --html-block            Filter html block nodes\n  --custom-inline         Filter custom inline nodes\n  --custom-block          Filter custom block nodes\n  --eof                   Filter eof nodes\n  -h, --help              Display help and exit\n  --version               Print the version and exit\n\nmkfilter@1.1.3\n```\n\n## API\n\n### filter\n\n```javascript\nfilter([opts][, cb])\n```\n\nFilter nodes by node type.\n\nReturns an output stream.\n\n* `opts` Object processing options.\n* `cb` Function callback function.\n\n#### Options\n\n* `input` Readable input stream.\n* `output` Writable output stream.\n\n## License\n\nMIT\n\n---\n\nCreated by [mkdoc](https://github.com/mkdoc/mkdoc) on April 18, 2016\n\n[mkdoc]: https://github.com/mkdoc/mkdoc\n[mkparse]: https://github.com/mkdoc/mkparse\n[commonmark]: http://commonmark.org\n[npm]: https://www.npmjs.com\n[github]: https://github.com\n[jshint]: http://jshint.com\n[jscs]: http://jscs.info\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkdoc%2Fmkfilter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkdoc%2Fmkfilter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkdoc%2Fmkfilter/lists"}