{"id":13595135,"url":"https://github.com/terror/present","last_synced_at":"2025-04-04T08:07:18.776Z","repository":{"id":37937253,"uuid":"463306384","full_name":"terror/present","owner":"terror","description":"A script interpolation engine for markdown documents","archived":false,"fork":false,"pushed_at":"2024-10-04T15:25:57.000Z","size":72,"stargazers_count":101,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T07:07:39.153Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terror.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING","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}},"created_at":"2022-02-24T21:25:39.000Z","updated_at":"2025-02-04T17:27:01.000Z","dependencies_parsed_at":"2024-10-30T01:25:06.091Z","dependency_job_id":null,"html_url":"https://github.com/terror/present","commit_stats":{"total_commits":41,"total_committers":3,"mean_commits":"13.666666666666666","dds":0.3902439024390244,"last_synced_commit":"5fcf5e2e8c79b5e7d2b205026bc66f2f243214bf"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terror%2Fpresent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terror%2Fpresent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terror%2Fpresent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terror%2Fpresent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terror","download_url":"https://codeload.github.com/terror/present/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247142065,"owners_count":20890652,"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-01T16:01:44.559Z","updated_at":"2025-04-04T08:07:18.750Z","avatar_url":"https://github.com/terror.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"## present\n\n[![CI](https://github.com/terror/present/actions/workflows/ci.yaml/badge.svg)](https://github.com/terror/present/actions/workflows/ci.yaml)\n[![crates.io](https://shields.io/crates/v/present.svg)](https://crates.io/crates/present)\n[![docs.rs](https://img.shields.io/docsrs/present)](https://docs.rs/present)\n\n**present** is a tool that lets you interpolate the standard output of arbitrary\nscripts that get interpreted by the shell into your markdown documents.\n\nIts aim is to provide a nice way to automatically update sections of your\nmarkdown documents that might be the standard output of a command, such as\ncommand-line utility help outputs or benchmarks.\n\n### Demo\n\nBelow is a short demo showcasing the main functionality of the program.\n\n[![asciicast](https://asciinema.org/a/6AO2ME0abbvn93dr4Dh4lenM0.svg)](https://asciinema.org/a/6AO2ME0abbvn93dr4Dh4lenM0)\n\n### CLI\n\nYou can install the `present` command-line utility with the rust package manager\n[cargo](https://github.com/rust-lang/cargo):\n\n```bash\n$ cargo install present\n```\n\nBelow is the standard output of `present --help`, interpolated by the `present`\nbinary itself!\n\n```present cargo run -- --help\nInterpolate the standard output of arbitrary shell scripts into your markdown files\n\nUsage: present [OPTIONS] [PATH]\n\nArguments:\n  [PATH]  A file or directory path to present.\n\nOptions:\n      --recursive    Recursively present markdown documents.\n      --in-place     Modify documents in place.\n      --interactive  Interactively present markdown documents.\n      --pretty       Pretty print documents to the terminal.\n      --remove       Remove commands within markdown documents.\n  -h, --help         Print help\n  -V, --version      Print version\n```\n\n### Library\n\n`present` can be used as a library by adding this line to the `[dependencies]`\nsection in `Cargo.toml`:\n\n```present ./bin/get_version\npresent = \"0.2.3\"\n```\n\nWith `present`, you can create a `File` struct by pointing it to a path. This\nwill parse all codeblocks with the `present` prefix, and add them as commands to\nthe struct. From there, you can present the file by using the `File::present`\nfunction, which will modify the internal content. From there, you can use the\n`File::print` or `File::save` functions to print the presented document to\nstdout or save it back to the original file.\n\n```rust\nuse std::path::PathBuf;\n\nfn main() {\n  let mut file = present::File::new(PathBuf::from(\"README.md\")).unwrap();\n  file.present().unwrap();\n  file.save();\n}\n```\n\n\u003e The above snippet is tested with rustdoc. A really cool side effect of this,\nis that the test loads the README itself, and runs `present` over it. `present`\nis also used throughout the README (to get help-text and version numbers), which\nmeans that when running `cargo test`, the README gets automatically updated.\n\nYou can read more about using the library on [docs.rs](https://docs.rs/present).\n\n### Examples\n\nBelow are a few examples showcasing what kind of command result interpolations\n`present` is currently able to handle.\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n  \u003ccode\u003epresent foo.md --in-place\u003c/code\u003e\n\u003c/td\u003e\n\u003ctd\u003e\n\n  ````ignore\n  foo\n\n  ```present echo bar\n  ```\n  ````\n\u003c/td\u003e\n\u003ctd\u003e\n\n  ````ignore\n  foo\n\n  ```present echo bar\n  bar\n  ```\n  ````\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctd\u003e\n  \u003ccode\u003epresent foo.md --in-place --remove\u003c/code\u003e\n\u003c/td\u003e\n\u003ctd\u003e\n\n  ````ignore\n  foo\n\n  ```present echo bar\n  ```\n  ````\n\u003c/td\u003e\n\u003ctd\u003e\n\n  ````ignore\n  foo\n\n  bar\n  ````\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n### Prior Art\n\nThis project is loosely inspired by [`Cog`](https://github.com/nedbat/cog), the\ncode generation tool. However, as mentioned above, this project's main target is\nmarkdown documents that may benefit to have certain sections automatically\nupdated, due to being the result of a command invocation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterror%2Fpresent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterror%2Fpresent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterror%2Fpresent/lists"}