{"id":17462195,"url":"https://github.com/executablebooks/markdown-it-plugin-template","last_synced_at":"2025-04-19T19:04:26.106Z","repository":{"id":43874612,"uuid":"380941939","full_name":"executablebooks/markdown-it-plugin-template","owner":"executablebooks","description":"A template for creating a markdown-it plugin.","archived":false,"fork":false,"pushed_at":"2023-01-09T02:36:24.000Z","size":1503,"stargazers_count":8,"open_issues_count":3,"forks_count":3,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-16T15:14:56.996Z","etag":null,"topics":["markdown-it","markdown-it-plugin"],"latest_commit_sha":null,"homepage":"https://executablebooks.github.io/markdown-it-plugin-template/","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/executablebooks.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":"2021-06-28T07:21:00.000Z","updated_at":"2025-02-06T16:32:34.000Z","dependencies_parsed_at":"2023-02-08T08:31:56.957Z","dependency_job_id":null,"html_url":"https://github.com/executablebooks/markdown-it-plugin-template","commit_stats":null,"previous_names":[],"tags_count":7,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/executablebooks%2Fmarkdown-it-plugin-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/executablebooks%2Fmarkdown-it-plugin-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/executablebooks%2Fmarkdown-it-plugin-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/executablebooks%2Fmarkdown-it-plugin-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/executablebooks","download_url":"https://codeload.github.com/executablebooks/markdown-it-plugin-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249275842,"owners_count":21242284,"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":["markdown-it","markdown-it-plugin"],"created_at":"2024-10-18T08:05:27.606Z","updated_at":"2025-04-19T19:04:26.064Z","avatar_url":"https://github.com/executablebooks.png","language":"JavaScript","readme":"# Markdown-It Plugin Template\n\n[![ci-badge]][ci-link]\n[![npm-badge]][npm-link]\n\nA template for creating a [markdown-it](https://github.com/markdown-it/markdown-it) plugin.\n\nSee \u003chttps://executablebooks.github.io/markdown-it-plugin-template/\u003e for a demonstration!\n\n## Usage\n\nAs a Node module:\n\n```javascript\nimport MarkdownIt from \"markdown-it\"\nimport examplePlugin from \"markdown-it-plugin-template\"\n\nconst text = MarkdownIt().use(examplePlugin).render(\"*a*\")\n```\n\nIn the browser:\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003ctitle\u003eExample Page\u003c/title\u003e\n        \u003cscript src=\"https://cdn.jsdelivr.net/npm/markdown-it@12/dist/markdown-it.min.js\"\u003e\u003c/script\u003e\n        \u003cscript src=\"https://unpkg.com/markdown-it-plugin-template\"\u003e\u003c/script\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n        \u003cdiv id=\"demo\"\u003e\u003c/div\u003e\n        \u003cscript\u003e\n            const text = window.markdownit().use(window.markdownitExample).render(\"*a*\");\n            document.getElementById(\"demo\").innerHTML = text\n        \u003c/script\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Development\n\n### Features\n\n- TypeScript\n- Code Formatting ([prettier])\n- Code Linting ([eslint])\n- Testing and coverage ([jest])\n- Continuous Integration ([GitHub Actions])\n- Bundled as both UMD and ESM ([rollup])\n- Upload as [NPM] package and [unpkg] CDN\n- Simple demonstration website ([GitHub Pages])\n\n### Getting Started\n\n1. Create a GitHub repository [from the template](https://docs.github.com/en/github-ae@latest/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/creating-a-repository-from-a-template).\n2. Replace package details in the following files:\n   - `package.json`\n   - `LICENSE`\n   - `README.md`\n   - `rollup.config.js`\n3. Install the `node_module` dependencies: `npm install` or `npm ci` (see [Install a project with a clean slate](https://docs.npmjs.com/cli/v7/commands/npm-ci)).\n4. Run code formatting; `npm run format`, and linting: `npm run lint:fix`.\n5. Run the unit tests; `npm test`, or with coverage; `npm test -- --coverage`.\n\nNow you can start to adapt the code in `src/index.ts` for your plugin, starting with the [markdown-it development recommendations](https://github.com/markdown-it/markdown-it/blob/master/docs/development.md).\n\nModify the test in `tests/fixtures.spec.ts`, to load your plugin, then the \"fixtures\" in `tests/fixtures`, to provide a set of potential Markdown inputs and expected HTML outputs.\n\nOn commits/PRs to the `master` branch, the GH actions will trigger, running the linting, unit tests, and build tests.\nAdditionally setup and uncomment the [codecov](https://about.codecov.io/) action in `.github/workflows/ci.yml`, to provide automated CI coverage.\n\nFinally, you can update the version of your package, e.g.: `npm version patch -m \"🚀 RELEASE: v%s\"`, push to GitHub; `git push --follow-tags`, build; `npm run build`, and publish; `npm publish`.\n\nFinally, you can adapt the HTML document in `docs/`, to load both markdown-it and the plugin (from [unpkg]), then render text from an input area.\nThis can be deployed by [GitHub Pages].\n\n## Design choices\n\n### Why is markdown-it only in devDependencies?\n\nFrom the [markdown-it development recommendations](https://github.com/markdown-it/markdown-it/blob/master/docs/development.md):\n\n\u003e Plugins should not require the `markdown-it` package as a dependency in `package.json`.\n\nNote, for typing, we import this package with `import type`, to ensure the imports are not present in the compiled JavaScript.\n\n### Why Jest?\n\nThere are a number of JavaScript unit testing frameworks (see [this comparison](https://raygun.com/blog/javascript-unit-testing-frameworks/), but [jest] was chosen because of it is easy to setup/use, flexible, and well used in large projects.\n\n### Why Rollup?\n\nThe three main bundlers are; Webpack, Rollup and Parcel, with the functionality gap between all of these bundlers narrowing over the years.\nEssentially, Rollup provides a middle ground between features and complexity, and is good for bundling libraries (it is what `markdown-it` itself [uses](https://github.com/markdown-it/markdown-it/blob/064d602c6890715277978af810a903ab014efc73/support/rollup.config.js)).\n\nSee for example:\n\n- \u003chttps://medium.com/@PepsRyuu/why-i-use-rollup-and-not-webpack-e3ab163f4fd3\u003e\n- \u003chttps://medium.com/js-imaginea/comparing-bundlers-webpack-rollup-parcel-f8f5dc609cfd\u003e\n- \u003chttps://betterprogramming.pub/the-battle-of-bundlers-6333a4e3eda9\u003e\n\n\n[ci-badge]: https://github.com/executablebooks/markdown-it-plugin-template/workflows/CI/badge.svg\n[ci-link]: https://github.com/executablebooks/markdown-it--plugin-template/actions\n[npm-badge]: https://img.shields.io/npm/v/markdown-it-plugin-template.svg\n[npm-link]: https://www.npmjs.com/package/markdown-it-plugin-template\n\n[GitHub Actions]: https://docs.github.com/en/actions\n[GitHub Pages]: https://docs.github.com/en/pages\n[prettier]: https://prettier.io/\n[eslint]: https://eslint.org/\n[Jest]: https://facebook.github.io/jest/\n[Rollup]: https://rollupjs.org\n[npm]: https://www.npmjs.com\n[unpkg]: https://unpkg.com/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexecutablebooks%2Fmarkdown-it-plugin-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexecutablebooks%2Fmarkdown-it-plugin-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexecutablebooks%2Fmarkdown-it-plugin-template/lists"}