{"id":33922567,"url":"https://github.com/oraqlle/mdbook-godbolt","last_synced_at":"2026-05-27T18:31:21.843Z","repository":{"id":271593054,"uuid":"910696801","full_name":"oraqlle/mdbook-godbolt","owner":"oraqlle","description":"A preprocessor for mdbook to add runnable code snippets via Godbolt","archived":false,"fork":false,"pushed_at":"2025-11-12T22:12:19.000Z","size":170,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-13T15:28:28.420Z","etag":null,"topics":["godbolt","mdbook","mdbook-plugin","mdbook-preprocessor"],"latest_commit_sha":null,"homepage":"","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/oraqlle.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-01T05:23:59.000Z","updated_at":"2025-11-12T08:06:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"f031548f-55a0-433e-92e2-65d15f3cfa2b","html_url":"https://github.com/oraqlle/mdbook-godbolt","commit_stats":null,"previous_names":["oraqlle/mdbook-godbolt"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/oraqlle/mdbook-godbolt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oraqlle%2Fmdbook-godbolt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oraqlle%2Fmdbook-godbolt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oraqlle%2Fmdbook-godbolt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oraqlle%2Fmdbook-godbolt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oraqlle","download_url":"https://codeload.github.com/oraqlle/mdbook-godbolt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oraqlle%2Fmdbook-godbolt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33579665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["godbolt","mdbook","mdbook-plugin","mdbook-preprocessor"],"created_at":"2025-12-12T09:05:20.894Z","updated_at":"2026-05-27T18:31:21.838Z","avatar_url":"https://github.com/oraqlle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mdbook-godbolt\n\nA preprocessor for mdbook to add runnable code snippets via Godbolt, similar to Rust\n*playground* snippets.\n\n## Installation\n\n### Prerequisits:\n\n- rust\n- mdbook\n\n### Download\n\n```sh\ncargo install mdbook-godbolt --locked\n```\n\nor\n\n```sh\ncargo install --git https://github.com/oraqlle/mdbook-godbolt.git\n```\n\n### Setup\n\nIn your books directory:\n\n```sh\nmdbook-godbolt install\n```\n\n## Usage\n\nYou can make a code snippet executable by adding the `godbolt` *attribute* to the opening\ncode fence. This will wrap the resulting HTML element in a `\u003cdiv\u003e` with the `godbolt`\nclass. There must be a language specified, both for godbolt and so your codeblock gets\nsyntax highlighting from the main book processor.\n\nAdding `godbolt` does not do anything to make the code runnable as you at a minimun need\nto specify the compiler code. This is done by specify the `godbolt-compiler:\u003ccode\u003e`\nattribute. There is also the `godbolt-flags:\u003cflags\u003e` attribute (optional) which allows\nyou to specify a string of flags in any format you need up until the next comma or the\nend of the line.\n\nEvery attribute must be seperated by a comma with no spaces. A lookup table for compiler\ncodes can be found below.\n\nThe entire codeblock will be submitted to to the [godbolt API](https://github.com/compiler-explorer/compiler-explorer/blob/main/docs/API.md)\nas it appears in the markdown source (bar line-snipping designators if active). The other\nfeatures such as code copy, line-snipping etc. from mdBook are available as only wrapper\nHTML elements are added and code fences are stripped of the godbolt metadata before being\npassed back to the regular processor.\n\n### Example\n\n````markdown\n```cpp,godbolt,godbolt-compiler:g151,godbolt-flags:-std=c++17\n#include \u003ccmath\u003e\n#include \u003ciostream\u003e\n\nauto magnitude(auto const x, auto const y, auto const z) -\u003e double {\n    return std::sqrt(x * x + y * y + z * z);\n}\n\nauto main() -\u003e int {\n    auto const x = 2.;\n    auto const y = 3.;\n    auto const z = 5.;\n\n    std::cout \u003c\u003c \"The magnitude of the vector is \"\n              \u003c\u003c magnitude(x, y, z)\n              \u003c\u003c \"units.\\n\";\n\n    return 0;\n}\n```\n````\n\n## Compiler Code Table\n\n- [ ] TODO\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foraqlle%2Fmdbook-godbolt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foraqlle%2Fmdbook-godbolt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foraqlle%2Fmdbook-godbolt/lists"}