{"id":24756346,"url":"https://github.com/dalance/mdbook-transcheck","last_synced_at":"2025-10-11T02:31:38.783Z","repository":{"id":52400613,"uuid":"248203611","full_name":"dalance/mdbook-transcheck","owner":"dalance","description":"Checker for translated mdbook","archived":false,"fork":false,"pushed_at":"2023-09-15T06:56:06.000Z","size":58,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-19T03:48:57.626Z","etag":null,"topics":["mdbook","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/dalance.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"dalance"}},"created_at":"2020-03-18T10:41:38.000Z","updated_at":"2022-10-12T02:56:32.000Z","dependencies_parsed_at":"2023-02-15T13:01:39.432Z","dependency_job_id":null,"html_url":"https://github.com/dalance/mdbook-transcheck","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Fmdbook-transcheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Fmdbook-transcheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Fmdbook-transcheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalance%2Fmdbook-transcheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dalance","download_url":"https://codeload.github.com/dalance/mdbook-transcheck/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236026048,"owners_count":19083308,"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":["mdbook","rust"],"created_at":"2025-01-28T13:51:05.796Z","updated_at":"2025-10-11T02:31:33.385Z","avatar_url":"https://github.com/dalance.png","language":"Rust","funding_links":["https://github.com/sponsors/dalance"],"categories":[],"sub_categories":[],"readme":"# mdbook-transcheck\nChecker for translated mdbook\n\n[![Actions Status](https://github.com/dalance/mdbook-transcheck/workflows/Regression/badge.svg)](https://github.com/dalance/mdbook-transcheck/actions)\n[![Crates.io](https://img.shields.io/crates/v/mdbook-transcheck.svg)](https://crates.io/crates/mdbook-transcheck)\n\n# Install\n\n```console\n$ cargo install mdbook-transcheck\n```\n\n# Usage\n\n## Check\n\nThe following command checks whether `src` and `tgt` are synchronized.\n\n```console\n$ mdbook-transcheck src tgt\n```\n\n`src` is the source directory of original mdbook.\n`tgt` is the source directory of translated mdbook.\n\n## Fix\n\nThe following command applies the differences between `src` and `tgt` to `tgt`.\n\n```console\n$ mdbook-transcheck --fix src tgt\n```\n\n## Lint\n\nThe following command checks whether translated texts satisfy lint rules.\n\n```console\n$ mdbook-transcheck --lint src tgt\n```\n\n# Configuration\n\nThe configuration file is `transcheck.toml`, which is put at the repository root.\n\n```toml\nexcludes = [\"img/\"]\n[matcher]\nenable_code_comment_tweak = true\ncode_comment_header = \"# \"\n[linter]\nenable_emphasis_check = true\nenable_half_paren_check = true\nenable_full_paren_check = true\n```\n\n## root section\n\n| Key      | Value        | Default | Description                                                 |\n| -------- | ------------ | ------- | ----------------------------------------------------------- |\n| excludes | String Array | []      | Exclude paths which are relative path from source directory |\n\n## `[matcher]` section\n\n| Key                       | Value       | Default | Description                                                                                                                     |\n| ------------------------- | ----------- | ------- | ------------------------------------------------------------------------------------------------------------------------------- |\n| enable_code_comment_tweak | true, false | false   | Match code comment without `code_comment_header`                                                                                |\n| code_comment_header       | String      | `\"# \"`  |                                                                                                                                 |\n| keep_markdown_comment     | true, false | false   | Keep Markdown comment in original                                                                                               |\n| markdown_comment_begin    | String      | `(((`   |                                                                                                                                 |\n| markdown_comment_end      | String      | `)))`   |                                                                                                                                 |\n| similar_threshold         | Float       | 0.5     | If the ratio which the original and translated lines are matched exceeds `similar_threshold`, the line is judged as *modified*. |\n\n## `[linter]` section\n\n| Key                     | Value       | Default | Description                                                             |\n| ----------------------- | ----------- | ------- | ----------------------------------------------------------------------- |\n| enable_emphasis_check   | true, false | false   | Check wether emphasis (`*..*`/`**..**`) has spaces before and after it. |\n| enable_half_paren_check | true, false | false   | Check wether half-width paren (`()`) has ascii charactors only.         |\n| enable_full_paren_check | true, false | false   | Check wether full-width paren (`（）`) has non-ascii charactors.        |\n\n# Example\n\n```console\n$ mdbook-transcheck ./testcase/original ./testcase/translated\n\nError: target path is not found\n    source path: ./testcase/original/missing_file.md\n    target path: ./testcase/translated/missing_file.md\n\n\nError: source line has been modified\n source --\u003e ./testcase/original/mismatch_lines.md:5\n  |\n5 | This is an orange.\n  |            ^^ ^^\n  |\n\n target --\u003e ./testcase/translated/mismatch_lines.md:11\n   |\n11 | This is an apple.\n   |             ^^^\n   |\n\n\nError: lines has been inserted to the source file\n source --\u003e ./testcase/original/mismatch_lines.md:2\n  |\n2 | Orange\n  |\n  = hint: The lines should be inserted at ./testcase/translated/mismatch_lines.md:2\n\n\nError: lines has been removed from the source file\n target --\u003e ./testcase/translated/mismatch_lines.md:4\n  |\n4 | Lemon\n  |\n```\n\n# Markdown rule\n\nThe translated markdown should follow some rules.\n\n* Keep original lines\n* Comment out original lines by `\u003c!--` and `--\u003e`\n\n## Simple example\n\n* original\n\n```markdown\nApple\nOrange\nPeach\n```\n\n* translated\n\n```markdown\n\u003c!--\nApple\nOrange\nPeach\n--\u003e\nりんご\nオレンジ\n桃\n```\n\nThe following is NG because `\u003c!-- Apple` and `Peach --\u003e` are not matched with original lines.\n\n```markdown\n\u003c!-- Apple\nOrange\nPeach --\u003e\nりんご\nオレンジ\n桃\n```\n\n## Markdown comment\n\nIf the original text has markdown commets, the commets should be removed in the translated text because nested comment is not supported.\nThe differences by removing the comments are ignored by default.\n\n* original\n\n```markdown\nApple \u003c!-- ignore --\u003e\nOr\u003c!-- ignore --\u003eange\n\u003c!-- ignore --\u003ePeach\n```\n\n* translated\n\n```markdown\n\u003c!--\nApple \nOrange\nPeach\n--\u003e\nりんご\nオレンジ\n桃\n```\n\nIf you want to keep the comments, `keep_markdown_comment`, `markdown_comment_begin` and `markdown_comment_end` can be used like below:\n\n```toml\nkeep_markdown_comment = true\nmarkdown_comment_begin = \"(((\"\nmarkdown_comment_end = \")))\"\n```\n\n* original\n\n```markdown\nApple \u003c!-- ignore --\u003e\nOr\u003c!-- ignore --\u003eange\n\u003c!-- ignore --\u003ePeach\n```\n\n* translated\n\n```markdown\n\u003c!--\nApple ((( ignore )))\nOr((( ignore )))ange\n((( ignore )))Peach\n--\u003e\nりんご\nオレンジ\n桃\n```\n\n\n## Code block\n\n* original\n\n````markdown\n```rust\n// comment\nlet a = b; // comment\n```\n````\n\n* translated\n\n````markdown\n```rust\n// comment\n// コメント\nlet a = b; // comment\n           // コメント\n```\n````\n\nYou can use `# ` to hide the original comment.\n`enable_code_comment_tweak` should be `true`, and `code_comment_header` should be `# `.\n\n````markdown\n```rust\n# // comment\n// コメント\nlet a = b; // comment\n           // コメント\n```\n````\n\nYou can use `# // ` to hide the original code and comment.\n`enable_code_comment_tweak` should be `true`, and `code_comment_header` should be `# // `.\n\n````markdown\n```rust\n# // // comment\n// コメント\n# // let a = b; // comment\nlet a = b; // コメント\n```\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalance%2Fmdbook-transcheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdalance%2Fmdbook-transcheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalance%2Fmdbook-transcheck/lists"}