{"id":13666051,"url":"https://github.com/yixuan/prettydoc","last_synced_at":"2025-05-16T02:09:29.312Z","repository":{"id":46922111,"uuid":"65159698","full_name":"yixuan/prettydoc","owner":"yixuan","description":"Creating Pretty HTML From R Markdown","archived":false,"fork":false,"pushed_at":"2021-01-26T08:38:40.000Z","size":3465,"stargazers_count":486,"open_issues_count":19,"forks_count":78,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-01T11:04:48.071Z","etag":null,"topics":["html","markdown","r-markdown"],"latest_commit_sha":null,"homepage":"https://prettydoc.statr.me/","language":"SCSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yixuan.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}},"created_at":"2016-08-07T23:59:21.000Z","updated_at":"2025-03-26T12:49:42.000Z","dependencies_parsed_at":"2022-08-31T11:51:59.183Z","dependency_job_id":null,"html_url":"https://github.com/yixuan/prettydoc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yixuan%2Fprettydoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yixuan%2Fprettydoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yixuan%2Fprettydoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yixuan%2Fprettydoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yixuan","download_url":"https://codeload.github.com/yixuan/prettydoc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247847608,"owners_count":21006099,"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":["html","markdown","r-markdown"],"created_at":"2024-08-02T06:00:56.606Z","updated_at":"2025-04-08T13:06:17.445Z","avatar_url":"https://github.com/yixuan.png","language":"SCSS","funding_links":[],"categories":["SCSS"],"sub_categories":[],"readme":"## Creating Pretty Documents From R Markdown\n\n\u003e Have you ever tried to find a lightweight yet nice theme for the R Markdown\ndocuments, like [this page](https://prettydoc.statr.me/cayman.html)?\n\n### Themes for R Markdown\n\nWith the powerful [rmarkdown](https://rmarkdown.rstudio.com/index.html)\npackage, we could easily create nice HTML document\nby adding some meta information in the header, for example\n\n```yaml\n---\ntitle: Nineteen Years Later\nauthor: Harry Potter\ndate: July 31, 2016\noutput:\n  rmarkdown::html_document:\n    theme: lumen\n---\n```\n\nThe [html_document](https://bookdown.org/yihui/rmarkdown/html-document.html)\nengine uses the [Bootswatch](https://bootswatch.com/)\ntheme library to support different styles of the document.\nThis is a quick and easy way to tune the appearance of your document, yet with\nthe price of a large file size (\u003e 700KB) since the whole\n[Bootstrap](https://getbootstrap.com/) library needs to be packed in.\n\nFor package vignettes, we can use the\n[html_vignette](https://bookdown.org/yihui/rmarkdown/r-package-vignette.html)\nengine to generate a more lightweight HTML file that is meant to minimize the\npackage size, but the output HTML is less stylish than the `html_document` ones.\n\nSo can we do **BOTH**, a lightweight yet nice-looking theme for R Markdown?\n\n### The prettydoc Engine\n\nThe answer is YES! (At least towards that direction)\n\nThe **prettydoc** package provides an alternative engine, `html_pretty`,\nto knit your R Markdown document into pretty HTML pages.\nIts usage is extremely easy: simply replace the\n`rmarkdown::html_document` or `rmarkdown::html_vignette` output engine by\n`prettydoc::html_pretty` in your R Markdown header, and use one of the built-in\nthemes and syntax highlighters. For example\n\n```yaml\n---\ntitle: Nineteen Years Later\nauthor: Harry Potter\ndate: July 31, 2016\noutput:\n  prettydoc::html_pretty:\n    theme: cayman\n    highlight: github\n---\n```\n\nYou can also create documents from **prettydoc** templates in RStudio.\n\n**Step 1:** Click the \"New File\" button and choose \"R Markdown\".\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://prettydoc.statr.me/images/step1.png\" alt=\"Step 1\" /\u003e\n\u003c/div\u003e\n\n**Step 2:** In the \"From Template\" tab, choose one of the built-in templates.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://prettydoc.statr.me/images/step2.png\" alt=\"Step 2\" /\u003e\n\u003c/div\u003e\n\n### Options and Themes\n\nThe options for the `html_pretty` engine are mostly compatible with the default\n`html_document`\n(see the [documentation](https://bookdown.org/yihui/rmarkdown/html-document.html))\nwith a few exceptions:\n\n1. Currently the `theme` option can take the following values. More themes will\nbe added in the future.\n    - `cayman`: Modified from the [Cayman](https://github.com/jasonlong/cayman-theme) theme.\n    - `tactile`: Modified from the [Tactile](https://github.com/jasonlong/tactile-theme) theme.\n    - `architect`: Modified from the [Architect](https://github.com/jasonlong/architect-theme) theme.\n    - `leonids`: Modified from the [Leonids](https://github.com/renyuanz/leonids) theme.\n    - `hpstr`: Modified from the [HPSTR](https://github.com/mmistakes/jekyll-theme-hpstr) theme.\n2. The `highlight` option takes value from `github` and `vignette`.\n3. A new `math` parameter to choose between `mathjax` and `katex` for rendering math expressions.\n   The `katex` option supports offline display when there is no internet connection.\n4. Options `code_folding`, `code_download` and `toc_float` are not applicable.\n\n### Offline Math Expressions\n\nBy default, `html_pretty` uses MathJax to render math expressions. However, using MathJax\nrequires an internet connection. If you need to create documents that can\nshow math expressions offline, simply add one line `math: katex` to the document metadata:\n\n```yaml\n---\ntitle: Nineteen Years Later\nauthor: Harry Potter\ndate: July 31, 2016\noutput:\n  prettydoc::html_pretty:\n    theme: cayman\n    highlight: github\n    math: katex\n---\n```\n\nThis option will enable [KaTeX](https://katex.org/) for rendering the math expressions, and all\nresource files will be included in for offline viewing. The offline document will be ~800k larger.\n\n### Related Projects\n\n- [tufte](https://github.com/rstudio/tufte) provides the Tufte style for\nR Markdown documents.\n- [BiocStyle](https://bioconductor.org/packages/release/bioc/html/BiocStyle.html)\nprovides standard formatting styles for Bioconductor PDF and HTML documents.\n- [rmdformats](https://github.com/juba/rmdformats) by Julien Barnier contains\nHTML formats and templates for R Markdown documents, with some extra features\nsuch as automatic table of contents, lightboxed figures, and dynamic crosstab\nhelper.\n- [markdowntemplates](https://github.com/hrbrmstr/markdowntemplates) by Bob Rudis\nis a collection of alternative R Markdown templates.\n- [prettyjekyll](https://github.com/privefl/prettyjekyll) by Florian Privé\nuses **prettydoc** to convert R Markdown documents to Jekyll Markdown for blog posting.\n\n\n### Gallery\n\nHere are some screenshots of the HTML pages generated by **prettydoc** with\ndifferent themes and syntax highlighters.\n\n#### Cayman [(demo page)](https://prettydoc.statr.me/cayman.html)\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"600px\" src=\"https://prettydoc.statr.me/images/cayman.png\" alt=\"Cayman Theme\" /\u003e\n\u003c/div\u003e\n\n#### Tactile [(demo page)](https://prettydoc.statr.me/tactile.html)\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"600px\" src=\"https://prettydoc.statr.me/images/tactile.png\" alt=\"Tactile Theme\" /\u003e\n\u003c/div\u003e\n\n#### Architect [(demo page)](https://prettydoc.statr.me/architect.html)\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"600px\" src=\"https://prettydoc.statr.me/images/architect.png\" alt=\"Architect Theme\" /\u003e\n\u003c/div\u003e\n\n#### Leonids [(demo page)](https://prettydoc.statr.me/leonids.html)\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"800px\" src=\"https://prettydoc.statr.me/images/leonids.png\" alt=\"Leonids Theme\" /\u003e\n\u003c/div\u003e\n\n#### HPSTR [(demo page)](https://prettydoc.statr.me/hpstr.html)\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"600px\" src=\"https://prettydoc.statr.me/images/hpstr.png\" alt=\"HPSTR Theme\" /\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyixuan%2Fprettydoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyixuan%2Fprettydoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyixuan%2Fprettydoc/lists"}