{"id":16965148,"url":"https://github.com/gregswindle/markdown-decorator","last_synced_at":"2025-04-05T15:46:13.033Z","repository":{"id":90405131,"uuid":"97658447","full_name":"gregswindle/markdown-decorator","owner":"gregswindle","description":"A lightweight utility for inserting blocks of text into markdown files.","archived":false,"fork":false,"pushed_at":"2019-01-27T09:43:39.000Z","size":188,"stargazers_count":0,"open_issues_count":11,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-11T12:44:41.529Z","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/gregswindle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-19T01:17:56.000Z","updated_at":"2022-07-13T03:27:27.000Z","dependencies_parsed_at":"2023-08-01T11:16:05.645Z","dependency_job_id":null,"html_url":"https://github.com/gregswindle/markdown-decorator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregswindle%2Fmarkdown-decorator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregswindle%2Fmarkdown-decorator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregswindle%2Fmarkdown-decorator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregswindle%2Fmarkdown-decorator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregswindle","download_url":"https://codeload.github.com/gregswindle/markdown-decorator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361598,"owners_count":20926642,"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-10-13T23:45:09.637Z","updated_at":"2025-04-05T15:46:13.028Z","avatar_url":"https://github.com/gregswindle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `markdown-decorator`\n\n[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Windows build status][appveyor-image]][appveyor-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Codacy Badge][codacy-image]][codacy-url] [![Coverage percentage][coveralls-image]][coveralls-url] [![License][license-image]][license-url]\n\n\u003e A lightweight utility for inserting text into markdown files and templates.\n\n## Table of contents\n\n\u003c!-- toc --\u003e\n\n- [1. Installation](#1-installation)\n- [2. Usage](#2-usage)\n  * [2.1. Pass a markdown string to its constructor](#21-pass-a-markdown-string-to-its-constructor)\n  * [2.2. Insert your product's (semantic) version](#22-insert-your-products-semantic-version)\n  * [2.3. Generate a table of contents](#23-generate-a-table-of-contents)\n  * [2.4. Method chaining](#24-method-chaining)\n  * [2.5. Templates](#25-templates)\n  * [2.6. Insert a string between delimiters](#26-insert-a-string-between-delimiters)\n- [3. Version and CHANGELOG](#3-version-and-changelog)\n- [4. Contributing](#4-contributing)\n- [5. License](#5-license)\n\n\u003c!-- tocstop --\u003e\n\n\u003c!-- tocend --\u003e\n\n\n## 1. Installation\n\n```sh\n$ npm install --save markdown-decorator\n```\n\n## 2. Usage\n\n### 2.1. Pass a markdown string to its constructor\n\n```js\nconst MarkdownDecorator = require('markdown-decorator')\nconst fs = require('fs')\nconst pkg = require('./package')\n\nconst decorator = new MarkdownDecorator(fs.readFileSync('README.md'))\n\n```\n\n### 2.2. Insert your product's (semantic) version\n\n```text\n## Version and CHANGELOG\n\n`markdown-decorator`'s latest version is\n\u003c!-- semver --\u003e\n\u003c!-- semverend --\u003e.\nPlease read the [CHANGELOG][changelog-url] for details.\n```\n\n```js\n// pkg.version === '1.1.0-alpha.1'\ndecorator.semver(pkg.version)\n```\n\nInserts the semver:\n\n```text\n## Version and CHANGELOG\n\n`markdown-decorator`'s latest version is\n\u003c!-- semver --\u003e1.1.0-alpha.1\u003c!-- semverend --\u003e.\nPlease read the [CHANGELOG][changelog-url] for details.\n```\n\n### 2.3. Generate a table of contents\n\nUse `toc` comment tags as delimiters:\n\n```text\n## Table of contents\n\u003c!-- toc --\u003e\n\u003c!-- tocend --\u003e\n```\n\n```js\ndecorator.toc(markdown)\n```\n\n### 2.4. Method chaining\n\n```js\nconst md = decorator\n  .semver(pkg.version)\n  .toc(markdown)\n  .toString()\n```\n\n### 2.5. Templates\n\n```text\n\u003c%= header %\u003e\n\u003c%= body %\u003e\n---\n\u003c%= footer %\u003e\n```\n\nUse the `decorate` method with an object literal to insert values in your template:\n\n```js\nconst md = decorator.decorate({\n  version: '1.0.0'\n})\n.toString({\n  template,\n  header: '# TEMPLATE HEADER',\n  body: decorator.markdown,\n  footer: 'TEMPLATE FOOTER'\n})\n```\n\n### 2.6. Insert a string between delimiters\n\n```text\n# `\u003c!-- title --\u003e\u003c!-- titleend --\u003e`\n```\n\n```js\ndecorator.insert('markdown-decorator', {\n\topen: 'title',\n\tclose: 'titleend'\n})\ndecorator.markdown\n// =\u003e # `\u003c!-- title --\u003emarkdown-decorator\u003c!-- titleend --\u003e`\n```\n\n## 3. Version and CHANGELOG\n\n`markdown-decorator` is at \u003c!-- semver --\u003e[`v1.0.0`](./CHANGELOG.md)\u003c!-- semverend --\u003e. Please see the [CHANGELOG](./CHANGELOG.md) for details.\n\n## 4. Contributing\n\n[![PRs Welcome][makeapullrequest-image]][makeapullrequest-url] We welcome contributors and pull requests. Check out the guidelines for\n\n* [Contributing to `generator-apiproxy`](./.github/CONTRIBUTING.md) and our\n* [Contributor Covenant Code of Conduct][code-of-conduct-url].\n\nContributions are stories with a beginning, a middle, and an end, all told through issues, comments, commit logs, and pull requests.\n\n * [Peruse open issues][issues-url] or\n * [Open a new pull request (PR)][pr-url]\n\n## 5. License\n\n[![License][license-image]][license-url] © [Greg Swindle](https://github.com/gregswindle)\n\n---\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/gregswindle/markdown-decorator.svg)](https://greenkeeper.io/)\n\n\n\n[appveyor-image]: https://ci.appveyor.com/api/projects/status/fr4s80kngal87oa7/branch/master?svg=true\n[appveyor-url]: https://ci.appveyor.com/project/gregswindle/markdown-decorator/branch/master\n[codacy-image]: https://api.codacy.com/project/badge/Grade/be8fc7f9a20f4e178c4fa067a4aad7c7\n[codacy-url]: https://www.codacy.com/app/greg_7/markdown-decorator?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=gregswindle/markdown-decorator\u0026amp;utm_campaign=Badge_Grade\n[code-of-conduct-url]: ./.github/CODE_OF_CONDUCT.md\n[coveralls-image]: https://coveralls.io/repos/gregswindle/markdown-decorator/badge.svg\n[coveralls-url]: https://coveralls.io/r/gregswindle/markdown-decorator\n[daviddm-image]: https://david-dm.org/gregswindle/markdown-decorator.svg?theme=shields.io\n[daviddm-url]: https://david-dm.org/gregswindle/markdown-decorator\n[issues-url]: (https://github.com/gregswindle/markdown-decorator/issues\n[license-image]: https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat\n[license-url]: ./LICENSE\n[makeapullrequest-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square\n[makeapullrequest-url]: http://makeapullrequest.com\n[new-issue-url]: https://github.com/gregswindle/markdown-decorator/issues/new\n[npm-image]: https://badge.fury.io/js/markdown-decorator.svg\n[npm-url]: https://npmjs.org/package/markdown-decorator\n[pr-course-url]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github\n[pr-url]: https://github.com/gregswindle/markdown-decorator/pulls\n[pr-url]: https://github.com/gregswindle/markdown-decorator/pulls\n[standard-version-url]: https://github.com/conventional-changelog/standard-version\n[travis-image]: https://travis-ci.org/gregswindle/markdown-decorator.svg?branch=master\n[travis-url]: https://travis-ci.org/gregswindle/markdown-decorator\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregswindle%2Fmarkdown-decorator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregswindle%2Fmarkdown-decorator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregswindle%2Fmarkdown-decorator/lists"}