{"id":13565917,"url":"https://github.com/egoist/vmark","last_synced_at":"2025-04-09T13:09:24.702Z","repository":{"id":45275121,"uuid":"121966867","full_name":"egoist/vmark","owner":"egoist","description":"Convert markdown to Vue component.","archived":false,"fork":false,"pushed_at":"2022-12-07T09:16:09.000Z","size":644,"stargazers_count":162,"open_issues_count":14,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-02T11:07:39.684Z","etag":null,"topics":[],"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/egoist.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":"2018-02-18T16:06:05.000Z","updated_at":"2024-05-16T17:24:57.000Z","dependencies_parsed_at":"2023-01-24T07:31:11.190Z","dependency_job_id":null,"html_url":"https://github.com/egoist/vmark","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fvmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fvmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fvmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Fvmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/egoist","download_url":"https://codeload.github.com/egoist/vmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045244,"owners_count":21038554,"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-08-01T13:01:57.869Z","updated_at":"2025-04-09T13:09:24.677Z","avatar_url":"https://github.com/egoist.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"\u003e __💖 Using webpack? You may want \u003ca href=\"https://github.com/egoist/vmark-loader\"\u003evmark-loader\u003c/a\u003e ➡️__\n\n# vmark\n\n[![NPM version](https://img.shields.io/npm/v/vmark.svg?style=flat)](https://npmjs.com/package/vmark) [![NPM downloads](https://img.shields.io/npm/dm/vmark.svg?style=flat)](https://npmjs.com/package/vmark) [![CircleCI](https://circleci.com/gh/egoist/vmark/tree/master.svg?style=shield)](https://circleci.com/gh/egoist/vmark/tree/master)  [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000\u0026style=flat)](https://github.com/egoist/donate) [![chat](https://img.shields.io/badge/chat-on%20discord-7289DA.svg?style=flat)](https://chat.egoist.moe)\n\n## Install\n\n```bash\nyarn add vmark\n```\n\n## Usage\n\nBasically you can write Markdown code alongside `\u003cscript\u003e` and `\u003cstyle\u003e` tags, and these tags work just like how it is in a normal `.vue` file.\n\nIn:\n\n```markdown\n# Show off some counter\n\n\u003ccounter :start=\"0\" /\u003e\n\n\u003cscript\u003e\nimport counter from './counter.vue'\nexport default {\n  components: {\n    counter\n  }\n}\n\u003c/script\u003e\n```\n\nOut:\n\n```vue\n\u003ctemplate\u003e\n  \u003cdiv class=\"vmark\"\u003e\n    \u003ch1\u003eShow off some counter\u003c/h1\u003e\n    \u003ccounter :start=\"0\" /\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\nimport counter from './counter.vue'\nexport default {\n  components: {\n    counter\n  }\n}\n\u003c/script\u003e\n```\n\nCode:\n\n```js\nconst component = vmark(input)\n// Get the component in SFC format\n```\n\n### Insert code block\n\nAutomatically transform:\n\n````markdown\n```vue {insert: 'below'}\n\u003cbutton\u003eButton\u003c/button\u003e\n```\n````\n\nInto:\n\n````markdown\n```vue\n\u003cbutton\u003eButton\u003c/button\u003e\n```\n\n\u003cbutton\u003eButton\u003c/button\u003e\n````\n\n`insert` can also be `above`.\n\n## API\n\n### vmark(input, [options])\n\n#### input\n\nType: `string`\u003cbr\u003e\nRequired: `true`\n\nInput markdown string.\n\n#### options\n\n##### options.markdown\n\nOptions for [markdown-it](https://markdown-it.github.io/markdown-it/).\n\n##### options.extend\n\n- Type: `(md: MarkdownIt) =\u003e void`\n\nA function whose first argument is the MarkdownIt instance.\n\n##### options.wrapHTML\n\n- Type: `(html: string) =\u003e string`\n- Default: \u003ccode\u003ehtml =\u003e \u0026#x60;\u0026lt;div class=\"vmark\"\u0026gt;${html}\u0026lt;/div\u0026gt;\u0026#x60;\u003c/code\u003e\n\nWrap the HTML in an element, because the `\u003ctemplate\u003e` block in Vue SFC doesn't allow multiple root elements. You can use this option to wrap HTML inside a Vue component:\n\n```js\nconst wrapHTML = html =\u003e `\u003crender-html\u003e${html}\u003c/render-html\u003e`\n```\n\nThen inside the `\u003crender-html\u003e` component, you can access the `html` like this:\n\n```vue\n\u003ctemplate\u003e\n  \u003cdiv class=\"content\"\u003e\n    \u003c!-- `html` is available as default slot --\u003e\n    \u003cslot name=\"default\"\u003e\u003c/slot\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n```\n\n## Contributing\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n\n## Author\n\n**vmark** © [egoist](https://github.com/egoist), Released under the [MIT](./LICENSE) License.\u003cbr\u003e\nAuthored and maintained by egoist with help from contributors ([list](https://github.com/egoist/vmark/contributors)).\n\n\u003e [github.com/egoist](https://github.com/egoist) · GitHub [@egoist](https://github.com/egoist) · Twitter [@_egoistlily](https://twitter.com/_egoistlily)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegoist%2Fvmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegoist%2Fvmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegoist%2Fvmark/lists"}