{"id":21385765,"url":"https://github.com/vrixyz/strinject","last_synced_at":"2025-04-15T19:41:48.070Z","repository":{"id":263799571,"uuid":"891395607","full_name":"Vrixyz/strinject","owner":"Vrixyz","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-16T09:31:45.000Z","size":55,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T17:57:40.021Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vrixyz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-11-20T09:03:20.000Z","updated_at":"2024-12-16T09:30:53.000Z","dependencies_parsed_at":"2024-11-20T12:06:16.974Z","dependency_job_id":"a261ca70-c545-41bc-a917-3460b2343de0","html_url":"https://github.com/Vrixyz/strinject","commit_stats":null,"previous_names":["vrixyz/text_inject","vrixyz/strinject"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vrixyz%2Fstrinject","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vrixyz%2Fstrinject/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vrixyz%2Fstrinject/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vrixyz%2Fstrinject/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vrixyz","download_url":"https://codeload.github.com/Vrixyz/strinject/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249140512,"owners_count":21219313,"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-22T11:50:46.650Z","updated_at":"2025-04-15T19:41:48.052Z","avatar_url":"https://github.com/Vrixyz.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Text Inject\n\n## Use case\n\nWhen writing documentation, it's useful to reference and inline code snippets.\n\n`strinject` helps you do that.\n\n## Features\n\nReplace text in a file, taking content from another file.\n\nA simple API:\n\n```rs\npub fn inject(source_text: \u0026str) -\u003e Result\u003cString, InjectError\u003e;\n```\n\n### Content Marker\n\nAny occurrence of the tag `\u003cload path='tests/to_inject1.txt' marker='ToInject1_1' /\u003e`\nwill load the file `tests/to_inject1.txt`, search for the text between `// DOCUSAURUS: ToInject1_1: start`\nand the next `// DOCUSAURUS: ToInject1_1: stop`, and replace the tag with the text between those markers.\n\n## Removes extraneous spaces\n\nUseful code is sometimes indented, `strinject` removes out-of-context indentation.\n\n## Download\n\nDownload external files pointed to by `path` with the feature `download`.\n\n## Recommendations\n\nWe advise to setup your own diff tooling to verify no unintended modifications were introduced\nafter the injection took place.\n\nSee [parry.rs CI](https://github.com/dimforge/parry.rs/pull/3) for an example of such tool.\n\n## Alternatives\n\n- `rustdoc` checks the whole inlined code, and allows to hide specific lines\n  - Good:\n    - Easy to use\n  - Bad:\n    - Not ideal for code snippets which need a lot of setup boilerplate.\n    - It is impractical to inline code with a more advanced setup.\n    - Less customizable, `strinject` is context agnostic.\n- using custom script with sed / awk / perl / whatever\n  - Good:\n    - it can work.\n  - Bad:\n    - cross-platform support is not ideal.\n    - not trivial to write, and even worse to read.\n- Tera/Askama/rinja/handlebars/\n  - Good:\n    - powerful\n  - Bad:\n    - A lot of features\n    - difficult to know if it's possible to search specific data from somewhere else.\n- manual copy pasting\n  - Good:\n    - Quick solution for simple cases\n  - Bad:\n    - error-prone\n    - difficult to verify code correctness\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvrixyz%2Fstrinject","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvrixyz%2Fstrinject","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvrixyz%2Fstrinject/lists"}