{"id":13907578,"url":"https://github.com/FreeMasen/mdbook-presentation-preprocessor","last_synced_at":"2025-07-18T05:33:05.043Z","repository":{"id":33277152,"uuid":"157021162","full_name":"FreeMasen/mdbook-presentation-preprocessor","owner":"FreeMasen","description":"A preprocessor for utilizing an MDBook as slides for a presentation.","archived":false,"fork":false,"pushed_at":"2024-01-22T21:45:03.000Z","size":1009,"stargazers_count":29,"open_issues_count":7,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-04T19:49:56.514Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FreeMasen.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}},"created_at":"2018-11-10T21:01:43.000Z","updated_at":"2025-03-31T11:56:01.000Z","dependencies_parsed_at":"2024-11-25T16:34:56.605Z","dependency_job_id":"6c85c1e5-fd00-4c20-96b3-0dbcf373bac4","html_url":"https://github.com/FreeMasen/mdbook-presentation-preprocessor","commit_stats":{"total_commits":34,"total_committers":3,"mean_commits":"11.333333333333334","dds":"0.23529411764705888","last_synced_commit":"91d74c6cb87fb301e29354220031594877918299"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/FreeMasen/mdbook-presentation-preprocessor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeMasen%2Fmdbook-presentation-preprocessor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeMasen%2Fmdbook-presentation-preprocessor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeMasen%2Fmdbook-presentation-preprocessor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeMasen%2Fmdbook-presentation-preprocessor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FreeMasen","download_url":"https://codeload.github.com/FreeMasen/mdbook-presentation-preprocessor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeMasen%2Fmdbook-presentation-preprocessor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265705436,"owners_count":23814455,"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-06T23:02:00.357Z","updated_at":"2025-07-18T05:33:04.640Z","avatar_url":"https://github.com/FreeMasen.png","language":"TypeScript","funding_links":[],"categories":["others","HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"# MDBook Presentation Preprocessor\nA preprocessor for utilizing an MDBook as slides\nfor a presentation.\n\nThe goal of this project is to allow the writing of one\nMDBook that can be used as both presentation and mdbook\nstyle website.\n\nSee it in action [here](https://freemasen.github.io/mdbook-presentation-preprocessor/),\nthe source for this is in the example directory.\n\n## Usage\nFirst you need to install the pre-processor by running the following\ncommand.\n\n```sh\ncargo install mdbook-presentation-preprocessor\n```\n\nNext you need to add the preprocessor to your `book.toml`\n```toml\n[book]\nauthors = [\"Your Name\"]\nmultilingual = false\nsrc = \"src\"\ntitle = \"An Interesting Thing\"\n[output.html]\n\n[preprocessor.presentation-preprocessor]\n```\n\nNow you can freely use the following syntax to mark\nsections of your book as web only or presentation only.\n```md\n# Header for the Page\n$web-only$\nThis content should only be displayed when the page\nis in web presentation mode\n$web-only-end$\n\n$slides-only$\nThis content should only be displayed when the page\nis in slide presentation mode\n$slides-only-end$\n$notes$\nThis content will always print to the console\nwhen this page is loaded. This can be useful\nwhen you break the dev-tools into its own window\nand keep that on presenter facing screen\n$notes-end$\n```\nTo toggle between slides and web, you can press `alt+p`.\n\nA current limitation is that you would not be able to conditionally\nextend a bulleted or numbered list. Instead it will create a second\nlist just below the first.\n\nSince MDBook doesn't offer paging from the `/` route, if you\nare in presentation mode and at `/`, it will automatically\nreload the page at the first entry in the navigation list.\n\n## How It Works\n\nThe preprocessor does two things, first it replaces\nall of the directives with with HTML comments that\nhave the same content.\n\n```md\n\n\u003c!-- slides-only--\u003e\n\n# Slides only information\n- is\n- found\n- here\n\n\u003c!-- slides-only-end--\u003e\n\n\u003c!--web-only--\u003e\n\n# Web only information\nWould be found here\n\n\u003c!--web-only-end--\u003e\n\n\u003c!--notes\nWould be found here\n--\u003e\n```\n\nSince inline HTML is still valid markdown it shouldn't impact\nthe rest of your book's ability to render.\n\nIt also inserts some `css` as `js` to each page.\n\nThe `js` does a few things, maintains a new `localStorage` variable\n`presentation_mode`. The value `1` is for web and the value `0`\nis for presentation. It also loops through the DOM, including the comments\nto add a new class to slides/web items and print the notes via `console.log`. This would make the above\nlook like this\n\n```html\n\u003c!-- slides-only--\u003e\n\u003ch1 class=\"presentation-only\"\u003eSlides only information\u003c/h1\u003e\n\u003cul class=\"presentation-only\"\u003e\n    \u003cli\u003eis\u003c/li\u003e\n    \u003cli\u003efound\u003c/li\u003e\n    \u003cli\u003ehere\u003c/li\u003e\n\u003c/ul\u003e\n\u003c!-- slides-only-end--\u003e\n\u003c!--web-only--\u003e\n\u003ch1 class=\"article-content\"\u003eWeb only information\u003c/h1\u003e\n\u003cp class=\"article-content\"\u003eWould be found here\u003c/p\u003e\n\u003c!--web-only-end--\u003e\n\u003c!--notes\nWould be found here\n--\u003e\n```\n\nIt also updates these items to have another class that\nindicates if `presentation_mode` is `Web` or `Slides`.\n\nAnd adds an event listener for the `alt+p` shortcut.\n\nDepending on the value of `presentation_mode` it will update\nall of the wrapped items to have an additional class of\neither `presenting` or `not-presenting`. The `css`\nwill set `display: hidden;` for any items that are\n`.article-content.presenting` or `.presentation-only.not-presenting`.\n\nOutside of that there is also a timer available. By default the timer is set to run 45 minutes, and will be mostly hidden on the right top side of the page and pop-out when moused over. The border will start black and slowly turn yellow, then orange then red as the end time approaches. To interact with this timer there are a few hot-keys to know.\n\n| hot-key       | action                           |\n|---------------|----------------------------------|\n| alt+g         | GO! (start the presentation)     |\n| alt+m         | Open the Minutes dialog          |\n| alt+ArrowUp   | Add a minute to the timer        |\n| alt+ArrowDown | Subtract a minute from the timer |\n| alt+.         | Full Stop the timer              |\n\nThe end time and length are stored in localStorage, this means in the same browser you would expect the same length of presentation that was used previously.\n\n# Contributing\nIf you are interested in contributing, I would be happy for the help\n\nIf you are find a bug, please open an issue!\n\nIf you want to make a change to the source code, please consider the following\n- The `./presentationHider.ts` file is where you should be editing any of the javascript\n    - To update the actual javascript, please run `tsc --outFile ./src/presentationHider.js`\n- The `./presentationHider.scss` file is where you should be editing any of the css\n    - To update the actual css please run your sass compiler of choice to update `./src/presentationHider.css`\n    - I personally use [`rsass`](https://crates.io/crates/rsass) with the following command\n        - `rsass ./presentationHider.scss \u003e ./src/presentationHider.css`\n- When editing any of the rust functionality, please keep any of the logic outside of the `impl Preprocessor` block to allow the code to be tested\n\nFor reference see [the api docs](https://github.com/FreeMasen/mdbook-presentation-preprocessor/blob/master/api_docs/api/presentationHider.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFreeMasen%2Fmdbook-presentation-preprocessor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFreeMasen%2Fmdbook-presentation-preprocessor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFreeMasen%2Fmdbook-presentation-preprocessor/lists"}