{"id":13483575,"url":"https://github.com/laysent/remark-ruby","last_synced_at":"2025-03-27T14:31:23.337Z","repository":{"id":38272645,"uuid":"176061375","full_name":"laysent/remark-ruby","owner":"laysent","description":"Custom syntax for remarkjs, adding ruby (furigana) to markdown.","archived":false,"fork":false,"pushed_at":"2023-07-19T01:11:39.000Z","size":938,"stargazers_count":24,"open_issues_count":4,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T17:06:39.415Z","etag":null,"topics":["furigana","remark-plugin","remarkjs"],"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/laysent.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}},"created_at":"2019-03-17T05:45:32.000Z","updated_at":"2024-12-17T08:11:34.000Z","dependencies_parsed_at":"2024-01-13T18:24:11.054Z","dependency_job_id":"b58e7856-f0e3-48e8-ad6b-9982503e1f99","html_url":"https://github.com/laysent/remark-ruby","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/laysent%2Fremark-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysent%2Fremark-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysent%2Fremark-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laysent%2Fremark-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laysent","download_url":"https://codeload.github.com/laysent/remark-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245863090,"owners_count":20684787,"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":["furigana","remark-plugin","remarkjs"],"created_at":"2024-07-31T17:01:12.959Z","updated_at":"2025-03-27T14:31:23.018Z","avatar_url":"https://github.com/laysent.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# remark-ruby\n\nThis [remark][remark] plugin parses custom Markdown syntax to produce (HTML) ruby.\n\nIt introduces a new [MDAST][mdast] node type: \"ruby\".\n\n```javascript\ninterface ruby \u003c: Node {\n  type: \"ruby\";\n  base: string;\n  text: string;\n  data: {\n    hName: \"ruby\";\n    hChildren: [\n      {\n        type: 'text',\n        value: string,\n      },\n      {\n        type: 'element',\n        children: [\n          { type: 'text', value: string }\n        ],\n        tagName: 'rp',\n      },\n      {\n        type: 'element',\n        children: [\n          { type: 'text', value: string }\n        ],\n        tagName: 'rt',\n      },\n      {\n        type: 'element',\n        children: [\n          { type: 'text', value: string },\n        ],\n        tagName: 'rp',\n      }\n    ],\n  },\n}\n```\n\n## Syntax\n\nRuby is defined in the following way:\n\n```markdown\nThis plugin works on {Markdown AST}^(MDAST).\n```\n\nThis would compile to the following HTML:\n\n```html\n\u003cp\u003eThis plugin works on \u003cruby\u003eMarkdown AST\u003crp\u003e(\u003c/rp\u003e\u003crt\u003eMDAST\u003c/rt\u003e\u003crp\u003e)\u003c/rp\u003e\u003c/p\u003e\n```\n\n### Text Delimitation\n\nYou could also use `[]` to delimit text:\n\n```markdown\n{[紳][士]}^([へん][たい])\n```\n\nThis would compile to the following HTML:\n\n```html\n\u003cp\u003e\u003cruby\u003e\u003crb\u003e紳\u003c/rb\u003e\u003crb\u003e士\u003c/rb\u003e\u003crp\u003e(\u003c/rp\u003e\u003crt\u003eへん\u003c/rt\u003e\u003crt\u003eたい\u003c/rt\u003e\u003crp\u003e)\u003c/rp\u003e\u003c/ruby\u003e\u003c/p\u003e\n```\n\nNotice that this requires the usage of `rb` tag, which is not supported by most of the browsers\nexcept Firefox. Check [caniuse](https://caniuse.com/#search=ruby) for details.\n\n## Installation\n\n[npm][npm]:\n\n```bash\nnpm install remark-ruby\n```\n\n## Usage\n\nDependencies:\n\n```javascript\nconst unified = require('unified')\nconst remarkParse = require('remark-parse')\nconst remarkRuby = require('remark-ruby')\nconst stringify = require('rehype-stringify')\nconst remark2rehype = require('remark-rehype')\n\n```\n\nUsage:\n\n```javascript\nunified()\n  .use(remarkParse)\n  .use(remarkRuby)\n  .use(remark2rehype)\n  .use(stringify)\n```\n\n## Options\n\n### options.parenthesis\n\nRuby fallback parenthesis which will be used in `rp` tag. It should be a string with at most two characters. The first will be used as left parenthesis, the last will be used as right parenthesis.\n\nBy default, it's value is `()`.\n\n**example**\n\n```javascript\n.use(remarkAbbr, { parenthesis: '「」' })\n```\n\n**given**\n\n```markdown\nThis plugin works on {Markdown AST}^(MDAST).\n```\n\n**produces**\n\n```html\n\u003cp\u003eThis plugin works on \u003cruby\u003eMarkdown AST\u003crp\u003e「\u003c/rp\u003e\u003crt\u003eMDAST\u003c/rt\u003e\u003crp\u003e」\u003c/rp\u003e\u003c/p\u003e\n```\n\n## License\n\n[MIT][license] © [LaySent][homepage]\n\n\u003c!-- Definitions --\u003e\n\n[license]: https://github.com/laysent/remark-ruby/blob/master/LICENSE\n\n[homepage]: https://github.com/laysent\n\n[npm]: https://www.npmjs.com/package/remark-ruby\n\n[mdast]: https://github.com/syntax-tree/mdast/blob/master/readme.md\n\n[remark]: https://github.com/remarkjs/remark\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaysent%2Fremark-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaysent%2Fremark-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaysent%2Fremark-ruby/lists"}