{"id":20760512,"url":"https://github.com/blueoakjs/markdownit-loader","last_synced_at":"2025-04-30T05:48:33.691Z","repository":{"id":57291264,"uuid":"84086326","full_name":"BlueOakJS/markdownit-loader","owner":"BlueOakJS","description":"Webpack loader to translate markdown to HTML using markdownit","archived":false,"fork":false,"pushed_at":"2017-07-25T16:35:01.000Z","size":37,"stargazers_count":12,"open_issues_count":2,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-30T05:48:28.498Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BlueOakJS.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":"2017-03-06T15:01:08.000Z","updated_at":"2023-07-17T19:19:10.000Z","dependencies_parsed_at":"2022-08-27T16:50:27.546Z","dependency_job_id":null,"html_url":"https://github.com/BlueOakJS/markdownit-loader","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueOakJS%2Fmarkdownit-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueOakJS%2Fmarkdownit-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueOakJS%2Fmarkdownit-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueOakJS%2Fmarkdownit-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlueOakJS","download_url":"https://codeload.github.com/BlueOakJS/markdownit-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251651220,"owners_count":21621702,"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-17T10:13:55.575Z","updated_at":"2025-04-30T05:48:33.672Z","avatar_url":"https://github.com/BlueOakJS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# markdownit-loader\n\n\u003e Convert Markdown file to HTML using markdown-it.\n\n## Installation\n\n```bash\nnpm i markdownit-loader --save-dev\n```\n\n## Features\n- Hot reload\n- Code highlighting using highlight.js\n\n\n## Usage\n[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)\n\n`webpack.config.js` file (webpack 2.x):\n\n```javascript\nmodule.exports = {\n  module: {\n    rules: [{\n      test: /\\.md/,\n      loader: 'markdownit-loader'\n    }]\n  }\n};\n```\n\n### Passing options to markdown-it\n\nSee [markdown-it](https://github.com/markdown-it/markdown-it#init-with-presets-and-options) for a complete list of possible options.\n\n```javascript\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.md/,\n        use: [\n          { loader: 'raw-loader' },\n          {\n            loader: 'markdownit-loader',\n            options: {\n              // markdown-it config\n              preset: 'default',\n              breaks: true,\n\n              preprocess: function(markdownIt, source) {\n                // do any thing\n\n                return source\n              },\n\n              use: [\n                /* markdown-it plugin */\n                'markdown-it-xxx',\n\n                /* or */\n                ['markdown-it-xxx', 'this is options']\n              ]\n            }\n          }\n        ]\n      }\n    ]\n  }\n};\n```\n\nOr you can customize markdown-it\n\n```javascript\nvar markdown = require('markdown-it')({\n  html: true,\n  breaks: true\n})\n\nmarkdown\n  .use(plugin1)\n  .use(plugin2, opts, ...)\n  .use(plugin3);\n\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.md/,\n        use: [\n          { loader: 'raw-loader' },\n          {\n            loader: 'markdownit-loader',\n            options: markdown\n          }\n        ]\n      }\n    ]\n  }\n};\n```\n\n\n## Note\nResource references can only use **absolute path**\n\ne.g.\n\nwebpack config\n```javascript\nresolve: {\n  alias: {\n    src: __dirname + '/src'\n  }\n}\n```\n\nIt'is work\n```markdown\n\u003cimg src=\"~src/images/abc.png\"\u003e\n\n\u003cscript\u003e\n  import Image from 'src/images/logo.png'\n  import Hello from 'src/components/hello.vue'\n\n  module.exports = {\n  }\n\u003c/script\u003e\n```\n\nIncorrect\n\n```markdown\n\u003cimg src=\"../images/abc.png\"\u003e\n\n\u003cscript\u003e\n  import Image from '../images/logo.png'\n  import Hello from './hello.vue'\n  module.exports = {\n  }\n\u003c/script\u003e\n```\n\n## Changelog\n\n- 2.0.0: Changed how plugins are passed to markdown-it (breaking API change) to fix an issue with vue-loader (THANKS [Pooya Parsa](https://github.com/pi0))\n\n## License\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueoakjs%2Fmarkdownit-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblueoakjs%2Fmarkdownit-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueoakjs%2Fmarkdownit-loader/lists"}