{"id":19607890,"url":"https://github.com/mkdoc/mklevel","last_synced_at":"2025-04-27T20:32:29.061Z","repository":{"id":57298893,"uuid":"54768141","full_name":"mkdoc/mklevel","owner":"mkdoc","description":"Modify heading levels","archived":true,"fork":false,"pushed_at":"2016-04-18T02:31:56.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-18T13:21:36.208Z","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-26T07:27:41.000Z","updated_at":"2024-12-11T22:13:08.000Z","dependencies_parsed_at":"2022-08-26T18:12:39.761Z","dependency_job_id":null,"html_url":"https://github.com/mkdoc/mklevel","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkdoc%2Fmklevel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkdoc%2Fmklevel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkdoc%2Fmklevel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkdoc%2Fmklevel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkdoc","download_url":"https://codeload.github.com/mkdoc/mklevel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251204565,"owners_count":21552239,"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:52.627Z","updated_at":"2025-04-27T20:32:27.893Z","avatar_url":"https://github.com/mkdoc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Heading Levels\n\n[![Build Status](https://travis-ci.org/mkdoc/mklevel.svg?v=3)](https://travis-ci.org/mkdoc/mklevel)\n[![npm version](http://img.shields.io/npm/v/mklevel.svg?v=3)](https://npmjs.org/package/mklevel)\n[![Coverage Status](https://coveralls.io/repos/mkdoc/mklevel/badge.svg?branch=master\u0026service=github\u0026v=3)](https://coveralls.io/github/mkdoc/mklevel?branch=master)\n\n\u003e Indent and outdent heading levels\n\nIncreases and decreases heading levels so the structure of a document may be modified.\n\nUseful when you have a standalone document that you wish to include in another document but the headings in the standalone document should be indented to fit the structure of the parent document.\n\n## Install\n\n```\nnpm i mklevel --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   - [level](#level)\n   - [Level](#level-1)\n- [License](#license)\n\n---\n\n## Usage\n\nCreate the stream and write a [commonmark][] document:\n\n```javascript\nvar lvl = require('mklevel')\n  , ast = require('mkast');\nast.src('# 1\\n\\n## 2\\n\\n### 3\\n\\n')\n  .pipe(lvl({levels: [1, 2, -1, 0, 0, 0]}))\n  .pipe(ast.stringify({indent: 2}))\n  .pipe(process.stdout);\n```\n\n## Example\n\nIncrement all heading levels:\n\n```shell\nmkcat README.md | mklevel --all=1 | mkout\n```\n\nDecrement all heading levels:\n\n```shell\nmkcat README.md | mklevel --all=-1 | mkout\n```\n\nConvert level 2 headings to level 5:\n\n```shell\nmkcat README.md | mklevel -2=3 | mkout\n```\n\nConvert level 1 and 3 headings to level 2:\n\n```shell\nmkcat README.md | mklevel -1=1 -3=-1 | mkout\n```\n\n## Help\n\n```\nmklevel [options]\n\nModify heading levels.\n\n  -1=[NUM]         Modify level 1 headings by NUM\n  -2=[NUM]         Modify level 2 headings by NUM\n  -3=[NUM]         Modify level 3 headings by NUM\n  -4=[NUM]         Modify level 4 headings by NUM\n  -5=[NUM]         Modify level 5 headings by NUM\n  -6=[NUM]         Modify level 6 headings by NUM\n  -a, --all=[NUM]  Modify all headings by NUM\n  -h, --help       Display this help and exit\n  --version        Print the version and exit\n\nReport bugs to https://github.com/mkdoc/mklevel/issues\n```\n\n## API\n\n### level\n\n```javascript\nlevel([opts][, cb])\n```\n\nGets the heading level stream.\n\nSee [Level](#level-1) for additional options.\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### Level\n\n```javascript\nnew Level([opts])\n```\n\nIncreases and decreases heading levels.\n\nTakes the integer values in the `levels` option and applies them by index\nto the headings in the stream.\n\nThe level modifier for level one headings is at index zero in the list.\n\nIf a level modifier would take a heading level beyond the permitted 1-6\nrange the value is clamped, so the following is a noop:\n\n```javascript\n{levels: [-1]}\n```\n\nBecause level one headings cannot be modified below one.\n\nTo convert all level one headings to level two:\n\n```javascript\n{levels: [1]}\n```\n\nTo increment headings 1-4 by one:\n\n```javascript\n{levels: [1,1,1,1]}\n```\n\nTo decrement all heading levels (except level 1 which cannot be\ndecremented):\n\n```javascript\n{all: -1}\n```\n\n* `opts` Object stream options.\n\n#### Options\n\n* `levels` Array list of integer level modifiers.\n* `all` Number use this value for all levels.\n\n## License\n\nMIT\n\n---\n\nCreated by [mkdoc](https://github.com/mkdoc/mkdoc) on March 27, 2016\n\n[mkdoc]: https://github.com/mkdoc/mkdoc\n[commonmark]: http://commonmark.org\n[jshint]: http://jshint.com\n[jscs]: http://jscs.info\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkdoc%2Fmklevel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkdoc%2Fmklevel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkdoc%2Fmklevel/lists"}