{"id":19751223,"url":"https://github.com/tkareine/hackers-tiny-slide-deck","last_synced_at":"2025-04-30T10:31:18.714Z","repository":{"id":36471810,"uuid":"222562100","full_name":"tkareine/hackers-tiny-slide-deck","owner":"tkareine","description":"Turn a Markdown document into a slide deck quickly","archived":false,"fork":false,"pushed_at":"2024-05-25T18:33:23.000Z","size":1011,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-29T13:16:04.662Z","etag":null,"topics":["css","hacking","javascript","markdown","minimalist","npm-package","presentation-framework","slide-deck","slideshow","slideshow-maker"],"latest_commit_sha":null,"homepage":"https://tkareine.github.io/hackers-tiny-slide-deck/example.html","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/tkareine.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2019-11-18T23:04:39.000Z","updated_at":"2024-08-12T19:55:00.000Z","dependencies_parsed_at":"2024-01-07T12:46:11.269Z","dependency_job_id":"14eda0db-9adf-4730-a23f-630deacbb1cc","html_url":"https://github.com/tkareine/hackers-tiny-slide-deck","commit_stats":{"total_commits":112,"total_committers":1,"mean_commits":112.0,"dds":0.0,"last_synced_commit":"363e9ca389e53a2a0f657a87eeeccf537751dcbe"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkareine%2Fhackers-tiny-slide-deck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkareine%2Fhackers-tiny-slide-deck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkareine%2Fhackers-tiny-slide-deck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkareine%2Fhackers-tiny-slide-deck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkareine","download_url":"https://codeload.github.com/tkareine/hackers-tiny-slide-deck/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251684510,"owners_count":21627143,"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":["css","hacking","javascript","markdown","minimalist","npm-package","presentation-framework","slide-deck","slideshow","slideshow-maker"],"created_at":"2024-11-12T02:42:55.040Z","updated_at":"2025-04-30T10:31:18.395Z","avatar_url":"https://github.com/tkareine.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hacker's Tiny Slide Deck (HTSD)\n\n[![npm version](https://badge.fury.io/js/hackers-tiny-slide-deck.svg)][HTSD-npm-package]\n[![CI](https://github.com/tkareine/hackers-tiny-slide-deck/workflows/CI/badge.svg)][HTSD-CI]\n\nTurn a Markdown document into a slide deck, in two steps:\n\n1. Add a `\u003cscript\u003e` tag referring the HTSD JavaScript bundle to the end\n   of the Markdown document. For example, accessing the bundle from\n   [jsDelivr] service:\n\n   ``` html\n   \u003cscript type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/hackers-tiny-slide-deck@VERSION/build/htsd.min.js\"\u003e\u003c/script\u003e\n   ```\n\n   (Replace `VERSION` with the version of this [npm\n   package][HTSD-npm-package].)\n\n2. Convert the Markdown document into html. For example, using [marked]:\n\n   ``` shell\n   marked -i example.md \u003e example.html\n   ```\n\nThis might be the preferable option for preparing a quick presentation.\n\nUse an editor plugin to make step 2 easier, preferably via a keyboard\nshortcut. For example, [markdown-mode] for Emacs has the\n`markdown-export-and-preview` (`C-c C-c v`) command, which converts the\n`.md` file in the current buffer to a `.html` file and opens the html in\nthe default browser.\n\nTo demonstrate the features quickly, see the sources of [example.md] and\nthe converted [html][example.html].\n\n## Features\n\n* Responsive CSS, with automatically scaling text size.\n* You can still adjust text size with the browser's zoom function.\n* Keyboard shortcuts to change slides:\n  * ⬅️ (left arrow) to show the previous slide\n  * ➡️ (right arrow) to show the next slide\n  * `Home` to show the first slide\n  * `End` to show the last slide\n* Keyboard shortcut to toggle fullscreen, `Shift+F`.\n* Swipe left and right gestures to change slides on mobile browsers.\n* Built for modern browsers (no support for old browsers).\n* Support browser history, remember current slide shown on reload.\n* Easy slide specific CSS styles with id attributes generated from\n  headers.\n* Intentionally kept simple to allow easy hacking and customization. If\n  you don't like something, download the source code and change it.\n* Tiny, currently 12 KiB in size (bundled, minified, not compressed).\n* Printing the html document is unaffected; CSS styles are for screen\n  media only.\n* Might be one of the fastest ways to prepare a slide deck!\n\n## Usage\n\nPrepare a Markdown document, with a `\u003cscript\u003e` tag referring\n`htsd.min.js`:\n\n``` markdown\n# Title\n\nI'm the first slide.\n\n---\n\n## Topic 1\n\nI'm the second slide.\n\n---\n\n# End\n\nThank you!\n\n\u003cscript type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/hackers-tiny-slide-deck@VERSION/build/htsd.min.js\"\u003e\u003c/script\u003e\n```\n\nWhere `VERSION` in the `\u003cscript\u003e`'s `src` attribute refers to a version\nof this [npm package][HTSD-npm-package].)\n\nConvert the `.md` file prepared above to `.html`. Here, using [marked]:\n\n``` shell\nmarked -i example.md \u003e example.html\n```\n\n## Conventions to turn Markdown into slides\n\nThis section lists the special conventions to turn the content of html\ngenerated from a Markdown document into slides.\n\n### Horizontal separators (`\u003chr\u003e`) separate slides\n\n``` markdown\n## Slide 1\n\n---\n\n## Slide 2\n\n```\n\nThe contents of each slide get wrapped in a `\u003cdiv\u003e` tag, with style\nclass `htsd-slide`. Every slide will have that as the base class. In\naddition, slides may have additional modifier classes and id attributes;\nread below for more.\n\nYou can utilize the base class (`htsd-slide`) for styling global to all\nslides.\n\n### Modifier class for the highest level header in a slide\n\n``` markdown\n# Title\n\n## Topic 1\n\nI'm centered.\n\n---\n\n## Topic 2\n\nI'm not centered.\n```\n\nHere, the slide with `\u003ch1\u003eTitle\u003c/h1\u003e` will have the `htsd-slide--h1`\nmodifier class in addition to the `htsd-slide` base class. HTSD includes\nCSS styles to center the content having the `htsd-slide--h1` class.\n\nThe slide with `\u003ch2\u003eTopic 2\u003c/h2\u003e` gets `htsd-slide--h2` as the modifier\nclass. HTSD has no special CSS styles for header levels below level 2,\nbut you can add them yourself.\n\n### Id attribute for the highest level header in a slide\n\nThe text contents of the highest level header in each slide is used to\ngenerate the id attributes for them. You can use this in the CSS\nselectors to customize styles (see [example.md]).\n\n## Customization\n\n### Customize styles\n\nUse a `\u003cstyle media=\"screen\"\u003e` tag to customize styles. There are custom\nCSS properties to help your tuning needs:\n\n``` css\n@import url(https://fonts.googleapis.com/css?family=Roboto:400,400i,700);\n\n/* override css custom properties */\n:root {\n  --htsd-sans-font-family: 'Roboto', sans-serif;\n  --htsd-slide-bg-color: #f6f6f6;\n  --htsd-header-color: #262626;\n  --htsd-text-color: #1a1a1a;\n}\n\n/* override rules with selectors */\n.htsd-slide em {\n  font-weight: bold;\n}\n```\n\nSee the end of [example.md] for more examples.\n\n### Syntax highlighting inside `\u003ccode\u003e` tags\n\nYou can enable syntax highlighting inside `\u003ccode\u003e` tags with an external\nJavaScript library, such as [Prism.js].\n\nSee the end of [example.md] to see how to highlight code with Prism.js.\n\n### Install HTSD manually\n\nBy default, loading `htsd.min.js` with the `\u003cscript\u003e` tag automatically\ninstalls all features. If you want to install features manually, use the\n`data-manual` attribute in the `\u003cscript\u003e` tag. For example:\n\n``` html\n\u003cscript type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/hackers-tiny-slide-deck@VERSION/build/htsd.min.js\" data-manual\u003e\u003c/script\u003e\n```\n\nHTSD provides the following object in `window`:\n\n``` javascript\nwindow.htsd = {\n  // calls, in order:\n  //\n  // 1. installStyles\n  // 2. installSlides\n  // 3. installNavigation\n  // 4. markInstalled\n  installAll: () =\u003e undefined,\n\n  // apply CSS styles by injecting a \u003cstyle\u003e tag into \u003chead\u003e;\n  // this will make \u003cbody\u003e invisible (the document goes blank)\n  installStyles: () =\u003e undefined,\n\n  // wrap content into \u003cdiv class=\"htsd-slide\"\u003e tags, to be used as slides\n  installSlides: () =\u003e undefined,\n\n  // 1. enable handling the hash part of browser location\n  // 2. show the selected slide (requires \u003cbody\u003e to be visible, see `markInstalled`)\n  // 3. make keyboard shortcuts and swipe gestures available\n  installNavigation: () =\u003e undefined,\n\n  // add `htsd--installed` class to the \u003cbody\u003e tag, make \u003cbody\u003e visible\n  markInstalled: () =\u003e undefined\n\n  // contains HTSD version number\n  version: string\n}\n```\n\nNow, you can call `installAll` manually:\n\n``` html\n\u003cscript type=\"text/javascript\"\u003ehtsd.installAll()\u003c/script\u003e\n```\n\nCalling the `install*` or `markInstalled` functions more than once leads\nto undefined behavior. The implementation is simpler without attempting\nto handle the complexities in different call combinations.\n\n## License\n\nMIT. See [LICENSE.txt].\n\n[HTSD-CI]: https://github.com/tkareine/hackers-tiny-slide-deck/actions/workflows/ci.yml\n[HTSD-npm-package]: https://www.npmjs.com/package/hackers-tiny-slide-deck\n[LICENSE.txt]: https://raw.githubusercontent.com/tkareine/hackers-tiny-slide-deck/master/LICENSE.txt\n[Prism.js]: https://prismjs.com/\n[example.html]: https://tkareine.github.io/hackers-tiny-slide-deck/example.html\n[example.md]: https://raw.githubusercontent.com/tkareine/hackers-tiny-slide-deck/master/example.md\n[jsDelivr]: https://www.jsdelivr.com/\n[markdown-mode]: https://jblevins.org/projects/markdown-mode/\n[marked]: https://github.com/markedjs/marked\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkareine%2Fhackers-tiny-slide-deck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkareine%2Fhackers-tiny-slide-deck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkareine%2Fhackers-tiny-slide-deck/lists"}