{"id":19214337,"url":"https://github.com/treeinfra/markdown-it-wordless","last_synced_at":"2025-06-14T07:02:23.958Z","repository":{"id":245511756,"uuid":"818027308","full_name":"treeinfra/markdown-it-wordless","owner":"treeinfra","description":"A markdown-it plugin to optimize wordless multi-language space render.","archived":false,"fork":false,"pushed_at":"2024-12-16T11:12:09.000Z","size":64,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T22:39:59.160Z","etag":null,"topics":["brumese","cambodian","chinese","dai","japanese","lao","line-break","markdown","markdown-it","markdown-it-plugin","markdown-renderer","thai","tibetan","vitepress","wordless","wordless-languages","yi"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/markdown-it-wordless?activeTab=readme","language":"TypeScript","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/treeinfra.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2024-06-21T00:19:53.000Z","updated_at":"2025-05-10T07:09:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"8f7b21aa-2cf2-406b-ab26-b62ee5098c80","html_url":"https://github.com/treeinfra/markdown-it-wordless","commit_stats":null,"previous_names":["treeinfra/markdown-it-wordless"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/treeinfra/markdown-it-wordless","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeinfra%2Fmarkdown-it-wordless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeinfra%2Fmarkdown-it-wordless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeinfra%2Fmarkdown-it-wordless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeinfra%2Fmarkdown-it-wordless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/treeinfra","download_url":"https://codeload.github.com/treeinfra/markdown-it-wordless/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeinfra%2Fmarkdown-it-wordless/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259775144,"owners_count":22909196,"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":["brumese","cambodian","chinese","dai","japanese","lao","line-break","markdown","markdown-it","markdown-it-plugin","markdown-renderer","thai","tibetan","vitepress","wordless","wordless-languages","yi"],"created_at":"2024-11-09T14:09:39.383Z","updated_at":"2025-06-14T07:02:23.921Z","avatar_url":"https://github.com/treeinfra.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Markdown-it Wordless\n\nDocumentation in:\n[English](https://treeinfra.github.io/markdown-it-wordless/) |\n[简体中文](https://treeinfra.github.io/markdown-it-wordless/zh/)\n\nA [markdown-it](https://markdown-it.github.io) plugin\nto optimize wordless multi-language line-break render.\n\nWhen a paragraph is long in markdown, we usually separate them into lines,\nand it will finally be rendered into a single line inside HTML.\nBut for wordless languages (such as Chinese and Japanese),\nthey do not use spaces to separate words,\nthat they don't need a space to be added when processing line-break.\n\nIf you are only working with a single wordless language,\nyou can definitely use the following code,\nwhich will disable all spaces when line break\n(render single `\\n` into an empty string rather than a space):\n\n```ts\nimport md from \"markdown-it\"\nmd.renderer.rules.softbreak = () =\u003e \"\" // [!code focus]\n```\n\nBut once working with multi-languages,\nespecially when there's a mix of wordless and wordful languages,\nsuch as using Chinese and English in a single markdown document,\nsuch options cannot handle all cases.\nSo here comes this `\"markdown-it-wordless\"` plugin,\nand you can use it like this:\n\n```ts\nimport md from \"markdown-it\"\nimport {Options} from \"markdown-it-wordless\"\nmd.use(wordless) // [!code focus]\n```\n\n## Basic rules\n\n1. Wordful languages (such as English and Arabic) will be rendered as usual.\n2. It won't add a space when line break between the same wordless language.\n3. It will add a space when line break between different wordless languages.\n4. Specially, Chinese and Japanese will be treated as a same language,\n   as there are many shared characters between them,\n   and their character styles are almost the same.\n5. Although Korean characters are like Chinese and Japanese (CJK),\n   Korean is not a wordless language, it uses spaces to separate words.\n\n## Use it with VitePress\n\n[VitePress](https://vitepress.dev) is an excellent static site generator,\nand this package is also inspired when the author using VitePress.\nIt's strongly recommended to add such plugin to VitePress\nif you are using wordless languages. And here's how to config:\n\n```ts\n// \u003croot\u003e/.vitepress/config.ts\nimport {defineConfig} from \"vitepress\"\nimport {wordless} from \"markdown-it-wordless\"\n\nexport default defineConfig({\n  markdown: {\n    config(md) {\n      md.use(wordless) // [!code focus]\n    },\n  },\n  // Other configs...\n})\n```\n\n## Customize to optimize performance\n\nThe default option will enable optimization\nfor all registered wordless languages inside this package.\nIf you want to optimize performance,\nyou can specify what exactly wordless language you are using.\nYou may also specify what wordful language you are using,\nbecause there's only optimization for wordful languages\nwhich unicode is less than `0x0dff`.\n\nHere's a simple example\nif you will only use Chinese or Japanese as wordless languages:\n\n```ts\nimport md from \"markdown-it\"\nimport {wordless, chineseAndJapanese, Options} from \"markdown-it-wordless\"\nmd.use\u003cOptions\u003e(wordless, {supportWordless: [chineseAndJapanese]}) // [!code focus]\n```\n\nSuch optimization is unnecessary in most cases,\nbecause this plugin will not slow down the rendering process a lot\nin common cases (only a few milliseconds).\nAnd if you do want to customize,\nplease make sure you've understand the source code. Please refer to\n[`data.ts`](https://github.com/treeinfra/markdown-it-wordless/blob/main/data.ts)\nfor more details,\nand here's documentation for each item in details.\n\n## About the supported languages\n\nYou can find all supported languages\nin the source code of\n[`data.ts`](https://github.com/treeinfra/markdown-it-wordless/blob/main/data.ts).\nEach language or language series is an exported const\nthat you can import and call.\n\nThe languages series are based on the [Unicode](https://unicode.org/charts/).\nMost of the languages are coded manually and some of them are\ngenerated by several AI models. So that there might be mistakes,\nand the author cannot guarantee the accuracy of the data\nbecause it's almost impossible for a single person to learn all such languages.\n\nIf you are native speaker of one of the those wordless languages\nand you find there are some mistakes,\nor if there's even some wordless languages not included in this package,\nplease feel free to open an issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreeinfra%2Fmarkdown-it-wordless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftreeinfra%2Fmarkdown-it-wordless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreeinfra%2Fmarkdown-it-wordless/lists"}