{"id":24983687,"url":"https://github.com/posthtml/posthtml-markdownit","last_synced_at":"2025-04-11T20:51:48.671Z","repository":{"id":40564341,"uuid":"259029392","full_name":"posthtml/posthtml-markdownit","owner":"posthtml","description":"A PostHTML plugin to transform Markdown using markdown-it","archived":false,"fork":false,"pushed_at":"2024-10-23T14:52:16.000Z","size":2022,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T21:06:06.562Z","etag":null,"topics":["html","markdown","posthtml","posthtml-plugin"],"latest_commit_sha":null,"homepage":"","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/posthtml.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-26T12:50:47.000Z","updated_at":"2024-10-23T14:52:27.000Z","dependencies_parsed_at":"2024-03-18T10:46:25.017Z","dependency_job_id":"5cc10761-4b56-40f7-bf77-8a28d18babd8","html_url":"https://github.com/posthtml/posthtml-markdownit","commit_stats":{"total_commits":168,"total_committers":6,"mean_commits":28.0,"dds":0.6130952380952381,"last_synced_commit":"07ae050a7461916b5b7f2632f494770cdb43bca0"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":"posthtml/posthtml-plugin-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-markdownit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-markdownit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-markdownit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-markdownit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posthtml","download_url":"https://codeload.github.com/posthtml/posthtml-markdownit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247928338,"owners_count":21019694,"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":["html","markdown","posthtml","posthtml-plugin"],"created_at":"2025-02-04T09:20:16.704Z","updated_at":"2025-04-11T20:51:48.649Z","avatar_url":"https://github.com/posthtml.png","language":"JavaScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"150\" height=\"150\" title=\"PostHTML\" src=\"https://posthtml.github.io/posthtml/logo.svg\"\u003e\n  \u003ch1\u003eposthtml-markdownit\u003c/h1\u003e\n  \n  Transform Markdown to HTML\n\n  [![Version][npm-version-shield]][npm]\n  [![Build][github-ci-shield]][github-ci]\n  [![License][license-shield]][license]\n  [![Downloads][npm-stats-shield]][npm-stats]\n\u003c/div\u003e\n\n## Introduction\n\nThis PostHTML plugin compiles Markdown to HTML using [markdown-it](https://github.com/markdown-it/markdown-it).\n\nBefore:\n\n```xml\n\u003cmarkdown\u003e\n  # Heading 1\n  ---\n\n  Paragraph with some text\n\n  _Italic_\n  **Bold**\n\n  - List item 1\n  - List item 2\n  - List item 3\n\u003c/markdown\u003e\n```\n\nAfter:\n\n```html\n\u003ch1\u003eHeading 1\u003c/h1\u003e\n\u003chr\u003e\n\u003cp\u003eParagraph with some text\u003c/p\u003e\n\u003cp\u003e\n  \u003cem\u003eItalic\u003c/em\u003e\n  \u003cstrong\u003eBold\u003c/strong\u003e\n\u003c/p\u003e\n\u003cul\u003e\n  \u003cli\u003eList item 1\u003c/li\u003e\n  \u003cli\u003eList item 2\u003c/li\u003e\n  \u003cli\u003eList item 3\u003c/li\u003e\n\u003c/ul\u003e\n```\n\n## Install\n\n```\nnpm i -D posthtml posthtml-markdownit\n```\n\n## Usage\n\n```js\nimport posthtml from 'posthtml'\nimport markdown from 'posthtml-markdownit'\n\nposthtml([\n  markdown()\n])\n  .process('\u003cmarkdown\u003e# Test\u003c/markdown\u003e')\n  .then(result =\u003e console.log(result.html))\n\n// \u003ch1\u003eTest\u003c/h1\u003e\n```\n\n### Importing files\n\nYou can import and render Markdown files:\n\nBefore:\n\n```xml\n\u003cmarkdown src=\"./README.md\"\u003e\n  # Imported\n\u003c/markdown\u003e\n```\n\nAfter:\n\n```html\n\u003c!-- Here be the contents of README.md, as HTML --\u003e\n\u003ch1\u003eImported\u003c/h1\u003e\n```\n\n## Syntax\n\n### Tags\n\nBoth `\u003cmarkdown\u003e` and `\u003cmd\u003e` tags are supported.\n\nBefore:\n\n```xml\n\u003cmd\u003e\n  # Heading 1\n\u003c/md\u003e\n```\n\nAfter:\n\n```html\n\u003ch1\u003eHeading 1\u003c/h1\u003e\n```\n\nBy default, the custom tags like `\u003cmd\u003e` are replaced with the compiled Markdown. See the [tag attribute](#tag) if you need a wrapping tag around your Markdown content.\n\n### Attributes\n\nYou can also use the `markdown` or `md` attributes on an HTML element:\n\nBefore:\n\n```html\n\u003cdiv md\u003e\n  # Heading 1\n\u003c/div\u003e\n```\n\nAfter:\n\n```html\n\u003ch1\u003eHeading 1\u003c/h1\u003e\n```\n\n#### `tag`\n\nYou can use a `tag` attribute to wrap the resulting markup in a tag:\n\nBefore:\n\n```xml\n\u003cmd tag=\"section\"\u003e\n  # Heading 1\n\u003c/md\u003e\n```\n\nAfter:\n\n```html\n\u003csection\u003e\n  \u003ch1\u003eHeading 1\u003c/h1\u003e\n\u003c/section\u003e\n```\n\n#### `inline`\n\nYou can mark the content to be rendered inline. This is helpful if you're including a file that will be used as an inline element and don't want the enclosing `p` tags.\n\nBefore:\n\n```xml\n\u003cdiv class=\"example\"\u003e\n  \u003cmarkdown src=\"./example.md\" inline\u003e\n    Imported\n  \u003c/markdown\u003e\n\u003c/div\u003e\n```\n\nAfter:\n\n```html\n\u003cp class=\"example\"\u003eImported\u003c/p\u003e\n```\n\nInstead of:\n\n```html\n\u003cdiv class=\"example\"\u003e\n  \u003cp\u003eImported\u003c/p\u003e\n\u003c/div\u003e\n```\n\n## Options\n\n### `root`\n\nType: `string`\\\nDefault: `./`\n\nA path relative to which Markdown files will be [imported](#importing-files).\n\n### `encoding`\n\nType: `string`\\\nDefault: `utf8`\n\nEncoding for imported Markdown files.\n\n### `markdownit`\n\nType: `object`\\\nDefault: `{}`\n\nOptions passed to the `markdown-it` library. See the [available options](https://github.com/markdown-it/markdown-it#init-with-presets-and-options).\n\n### `plugins`\n\nType: `array`\\\nDefault: `[]`\n\nPlugins for `markdown-it`.\n\nExample:\n\n```js\nimport {light as emoji} from 'markdown-it-emoji'\n\nmarkdown({\n  plugins: [{\n    plugin: emoji,\n    options: {} // Options for markdown-it-emoji\n  }]\n})\n```\n\n[npm]: https://www.npmjs.com/package/posthtml-markdownit\n[npm-version-shield]: https://img.shields.io/npm/v/posthtml-markdownit.svg\n[npm-stats]: http://npm-stat.com/charts.html?package=posthtml-markdownit\n[npm-stats-shield]: https://img.shields.io/npm/dt/posthtml-markdownit.svg\n[github-ci]: https://github.com/posthtml/posthtml-markdownit/actions/workflows/nodejs.yml\n[github-ci-shield]: https://github.com/posthtml/posthtml-markdownit/actions/workflows/nodejs.yml/badge.svg\n[license]: ./LICENSE\n[license-shield]: https://img.shields.io/npm/l/posthtml-markdownit.svg\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-markdownit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposthtml%2Fposthtml-markdownit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-markdownit/lists"}