├── .Rbuildignore ├── .github └── workflows │ ├── R-CMD-check.yaml │ ├── deps.R │ └── github-pages.yml ├── .gitignore ├── DESCRIPTION ├── LICENSE ├── LICENSE.md ├── Makefile ├── NAMESPACE ├── NEWS.md ├── R ├── format.R ├── fuse.R ├── mark.R ├── package.R ├── preview.R ├── site.R ├── utils.R └── zzz.R ├── README.md ├── docs ├── 01-start.Rmd ├── 02-fuse.Rmd ├── 03-syntax.Rmd ├── 04-mark.Rmd ├── 05-assets.Rmd ├── 06-widgets.Rmd ├── 07-editor.Rmd ├── 08-site.Rmd ├── A-rmarkdown.Rmd ├── B-vignettes.Rmd ├── _litedown.yml └── index.Rmd ├── examples ├── 001-minimal.Rmd ├── 001-minimal.md ├── 002-attr-options.Rmd ├── 002-attr-options.md ├── 003-attr-callout.Rmd ├── 003-attr-callout.md ├── 004-caption-position.Rmd ├── 004-caption-position.md ├── 005-option-code.Rmd ├── 005-option-code.md ├── 006-option-collapse.Rmd ├── 006-option-collapse.md ├── 007-option-comment.Rmd ├── 007-option-comment.md ├── 008-option-device.Rmd ├── 008-option-device.md ├── 009-option-figure-decoration.Rmd ├── 009-option-figure-decoration.md ├── 010-option-plot-files.Rmd ├── 010-option-plot-files.md ├── 011-option-label.Rmd ├── 011-option-label.md ├── 012-option-order.Rmd ├── 012-option-order.md ├── 013-option-print.Rmd ├── 013-option-print.md ├── 014-option-purl.R ├── 014-option-purl.Rmd ├── 014-option-purl.md ├── 015-fill-chunk.Rmd ├── 015-fill-chunk.md ├── 016-option-results.Rmd ├── 016-option-results.md ├── 017-option-strip-white.Rmd ├── 017-option-strip-white.md ├── 018-option-table.Rmd ├── 018-option-table.md ├── 019-option-verbose.Rmd ├── 019-option-verbose.md ├── 020-inline.Rmd ├── 020-inline.md ├── 021-simple-datatables.Rmd ├── 021-simple-datatables.md ├── 022-dygraphs.Rmd ├── 022-dygraphs.md ├── 023-leaflet.Rmd ├── 023-leaflet.md ├── 024-chart-js.Rmd ├── 024-chart-js.md ├── _run.R ├── test-inline.Rmd ├── test-inline.md ├── test-options.Rmd ├── test-options.md ├── test-results-hide.Rmd └── test-results-hide.md ├── inst └── resources │ ├── default.css │ ├── listing.css │ ├── litedown.html │ ├── litedown.latex │ ├── server.css │ ├── server.js │ ├── snap.css │ └── snap.js ├── litedown.Rproj ├── man ├── crack.Rd ├── engines.Rd ├── fuse_book.Rd ├── fuse_env.Rd ├── fuse_site.Rd ├── get_context.Rd ├── html_format.Rd ├── litedown-package.Rd ├── mark.Rd ├── markdown_options.Rd ├── pkg_desc.Rd ├── raw_text.Rd ├── reactor.Rd ├── roam.Rd ├── smartypants.Rd ├── timing_data.Rd └── vest.Rd ├── site ├── _footer.Rmd ├── _litedown.yml ├── action.yml ├── articles.Rmd ├── code.Rmd ├── examples.Rmd ├── index.Rmd ├── manual.Rmd └── news.Rmd ├── tests ├── empty.R ├── examples.R └── smartypants.R └── vignettes └── slides.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | ^.*\.Rproj$ 3 | ^\.Rproj\.user$ 4 | Makefile 5 | ^\.github$ 6 | ^LICENSE\.md$ 7 | ^docs$ 8 | ^examples$ 9 | ^site$ 10 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: [main] 4 | pull_request: 5 | branches: [main] 6 | 7 | name: R-CMD-check 8 | 9 | jobs: 10 | R-CMD-check: 11 | runs-on: ${{ matrix.config.os }} 12 | 13 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 14 | 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | config: 19 | - {os: ubuntu-latest, r: 'release'} 20 | - {os: ubuntu-latest, r: '4.4'} 21 | - {os: ubuntu-latest, r: '4.3'} 22 | - {os: ubuntu-latest, r: '4.2'} 23 | - {os: ubuntu-latest, r: '4.1'} 24 | - {os: ubuntu-latest, r: '4.0'} 25 | - {os: ubuntu-latest, r: '3.6'} 26 | - {os: ubuntu-latest, r: '3.5'} 27 | - {os: ubuntu-latest, r: '3.4'} 28 | - {os: ubuntu-latest, r: '3.3'} 29 | - {os: ubuntu-latest, r: '3.2'} 30 | - {os: ubuntu-latest, r: '3.2.0'} 31 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} 32 | - {os: macOS-latest, r: 'release'} 33 | - {os: windows-latest, r: 'release'} 34 | 35 | env: 36 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 37 | R_KEEP_PKG_SOURCE: yes 38 | _R_CHECK_FORCE_SUGGESTS_: false 39 | _R_CHECK_RD_XREFS_: false 40 | 41 | steps: 42 | - uses: actions/checkout@HEAD 43 | 44 | - uses: r-lib/actions/setup-r@HEAD 45 | with: 46 | r-version: ${{ matrix.config.r }} 47 | http-user-agent: ${{ matrix.config.http-user-agent }} 48 | use-public-rspm: true 49 | 50 | - name: Install dependencies for cairo_pdf device 51 | if: runner.os == 'macOS' 52 | run: | 53 | brew install --cask xquartz 54 | 55 | - name: Whether to use codecov 56 | run: | 57 | echo "USE_R_CODECOV=${{ (runner.os == 'Linux' && matrix.config.r == 'release') && true || false }}" >> $GITHUB_ENV 58 | 59 | - uses: r-lib/actions/setup-r-dependencies@HEAD 60 | if: matrix.config.r >= '4.0' 61 | with: 62 | # install the package itself as we register vignette engine 63 | extra-packages: any::rcmdcheck, local::. ${{ env.USE_R_CODECOV == 'true' && ', any::covr, any::xml2' || '' }} 64 | needs: check 65 | 66 | - uses: r-lib/actions/check-r-package@HEAD 67 | if: matrix.config.r >= '4.0' 68 | with: 69 | upload-snapshots: true 70 | 71 | - name: Check against R < 4.0 72 | if: matrix.config.r < '4.0' 73 | run: | 74 | Rscript .github/workflows/deps.R 75 | R CMD INSTALL . 76 | cd .. 77 | R CMD build litedown 78 | R CMD check --as-cran --no-manual litedown_*.tar.gz 79 | 80 | - name: Run examples 81 | working-directory: examples 82 | run: | 83 | Rscript _run.R 84 | git diff --quiet || (git diff && exit 1) 85 | 86 | - name: Test coverage 87 | if: success() && env.USE_R_CODECOV == 'true' 88 | run: | 89 | cov = covr::package_coverage( 90 | quiet = FALSE, 91 | clean = FALSE, 92 | install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") 93 | ) 94 | covr::to_cobertura(cov) 95 | xfun::file_string('./cobertura.xml') 96 | shell: Rscript {0} 97 | 98 | - uses: codecov/codecov-action@v5 99 | if: env.USE_R_CODECOV == 'true' 100 | with: 101 | fail_ci_if_error: ${{ github.event_name != 'pull_request' }} 102 | files: ./cobertura.xml 103 | plugins: noop 104 | disable_search: true 105 | 106 | - uses: actions/checkout@HEAD 107 | if: runner.os == 'macOS' 108 | with: 109 | path: gh-pages 110 | ref: gh-pages 111 | 112 | - name: Publish book 113 | if: runner.os == 'macOS' 114 | run: | 115 | Rscript -e 'install.packages("xfun", repos="https://yihui.r-universe.dev")' 116 | Rscript -e 'litedown::fuse_book("docs")' 117 | cd docs; cp -r *.html ../gh-pages/; cd ../gh-pages 118 | git config user.name github-actions 119 | git config user.email github-actions@github.com 120 | git add . 121 | git commit -m "update docs" && git push && curl -X POST ${{secrets.URL_DEPLOY_DOCS}} || true 122 | -------------------------------------------------------------------------------- /.github/workflows/deps.R: -------------------------------------------------------------------------------- 1 | if (getRversion() <= '3.2.1') for (m in c('wget', 'curl')) if (Sys.which(m) != '') { 2 | options(download.file.method = m) 3 | cat(sprintf('\noptions(download.file.method = "%s")\n', m), file = '~/.Rprofile', append = TRUE) 4 | break 5 | } 6 | install.packages(c('commonmark', 'xfun', 'rbibutils'), INSTALL_opts = '--no-help', quiet = TRUE) 7 | -------------------------------------------------------------------------------- /.github/workflows/github-pages.yml: -------------------------------------------------------------------------------- 1 | name: Build and deploy package site 2 | 3 | on: 4 | push: 5 | branches: ["main"] 6 | 7 | permissions: 8 | contents: read 9 | pages: write 10 | id-token: write 11 | 12 | jobs: 13 | deploy: 14 | environment: 15 | name: github-pages 16 | url: ${{ steps.deployment.outputs.page_url }} 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: actions/checkout@v4 20 | - uses: actions/configure-pages@v5 21 | with: 22 | enablement: true 23 | - uses: r-lib/actions/setup-r@HEAD 24 | with: 25 | use-public-rspm: true 26 | - uses: r-lib/actions/setup-r-dependencies@HEAD 27 | - uses: yihui/litedown/site@HEAD 28 | with: 29 | site-dir: 'site' 30 | - uses: actions/upload-pages-artifact@v3 31 | with: 32 | path: 'site' 33 | - id: deployment 34 | uses: actions/deploy-pages@v4 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | /examples/*__files/ 6 | /examples/figures/ 7 | /site/doc/ 8 | /site/_footer.md 9 | /docs/packages.bib 10 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: litedown 2 | Type: Package 3 | Title: A Lightweight Version of R Markdown 4 | Version: 0.7.1 5 | Authors@R: c( 6 | person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666", URL = "https://yihui.org")), 7 | person("Tim", "Taylor", role = "ctb", comment = c(ORCID = "0000-0002-8587-7113")), 8 | person() 9 | ) 10 | Description: Render R Markdown to Markdown (without using 'knitr'), and Markdown 11 | to lightweight HTML or 'LaTeX' documents with the 'commonmark' package (instead 12 | of 'Pandoc'). Some missing Markdown features in 'commonmark' are also 13 | supported, such as raw HTML or 'LaTeX' blocks, 'LaTeX' math, superscripts, 14 | subscripts, footnotes, element attributes, and appendices, 15 | but not all 'Pandoc' Markdown features are (or will be) supported. With 16 | additional JavaScript and CSS, you can also create HTML slides and articles. 17 | This package can be viewed as a trimmed-down version of R Markdown and 18 | 'knitr'. It does not aim at rich Markdown features or a large variety of 19 | output formats (the primary formats are HTML and 'LaTeX'). Book and website 20 | projects of multiple input documents are also supported. 21 | Depends: R (>= 3.2.0) 22 | Imports: 23 | utils, 24 | commonmark (>= 1.9.5), 25 | xfun (>= 0.52) 26 | Suggests: 27 | rbibutils, 28 | rstudioapi, 29 | tinytex 30 | License: MIT + file LICENSE 31 | URL: https://github.com/yihui/litedown 32 | BugReports: https://github.com/yihui/litedown/issues 33 | VignetteBuilder: litedown 34 | RoxygenNote: 7.3.2 35 | Encoding: UTF-8 36 | Roxygen: list(markdown = TRUE) 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2024-2025 2 | COPYRIGHT HOLDER: Yihui Xie 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2023 Posit Software, PBC 4 | Copyright (c) 2024-2025 Yihui Xie 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | ln -f ../lite.js/js/snap.js ../lite.js/css/snap.css ../lite.js/css/default.css inst/resources/ 3 | Rscript -e "Rd2roxygen::rab('.', install=TRUE)" 4 | rm litedown_*.tar.gz 5 | cd examples && Rscript _run.R 6 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(print,litedown_env) 4 | S3method(record_print,data.frame) 5 | S3method(record_print,knitr_kable) 6 | S3method(record_print,matrix) 7 | S3method(record_print,tbl_df) 8 | export(crack) 9 | export(engines) 10 | export(fiss) 11 | export(fuse) 12 | export(fuse_book) 13 | export(fuse_env) 14 | export(fuse_site) 15 | export(get_context) 16 | export(html_format) 17 | export(latex_format) 18 | export(mark) 19 | export(markdown_options) 20 | export(pkg_citation) 21 | export(pkg_code) 22 | export(pkg_desc) 23 | export(pkg_manual) 24 | export(pkg_news) 25 | export(raw_text) 26 | export(reactor) 27 | export(roam) 28 | export(sieve) 29 | export(timing_data) 30 | export(vest) 31 | import(utils) 32 | importFrom(xfun,Rscript_call) 33 | importFrom(xfun,alnum_id) 34 | importFrom(xfun,base64_uri) 35 | importFrom(xfun,csv_options) 36 | importFrom(xfun,del_empty_dir) 37 | importFrom(xfun,dir_create) 38 | importFrom(xfun,divide_chunk) 39 | importFrom(xfun,download_cache) 40 | importFrom(xfun,exit_call) 41 | importFrom(xfun,fenced_block) 42 | importFrom(xfun,fenced_div) 43 | importFrom(xfun,file_exists) 44 | importFrom(xfun,file_ext) 45 | importFrom(xfun,grep_sub) 46 | importFrom(xfun,html_escape) 47 | importFrom(xfun,html_tag) 48 | importFrom(xfun,html_value) 49 | importFrom(xfun,in_dir) 50 | importFrom(xfun,is_abs_path) 51 | importFrom(xfun,is_blank) 52 | importFrom(xfun,is_rel_path) 53 | importFrom(xfun,loadable) 54 | importFrom(xfun,mime_type) 55 | importFrom(xfun,new_app) 56 | importFrom(xfun,new_record) 57 | importFrom(xfun,normalize_path) 58 | importFrom(xfun,parse_only) 59 | importFrom(xfun,prose_index) 60 | importFrom(xfun,raw_string) 61 | importFrom(xfun,read_all) 62 | importFrom(xfun,read_utf8) 63 | importFrom(xfun,record_print) 64 | importFrom(xfun,relative_path) 65 | importFrom(xfun,same_path) 66 | importFrom(xfun,sans_ext) 67 | importFrom(xfun,set_envvar) 68 | importFrom(xfun,split_lines) 69 | importFrom(xfun,try_error) 70 | importFrom(xfun,try_silent) 71 | importFrom(xfun,with_ext) 72 | importFrom(xfun,write_utf8) 73 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # CHANGES IN litedown VERSION 0.8 2 | 3 | - The chunk option `results = 'hide'` will imply `collapse = TRUE`, i.e., when text output is hidden, the source blocks will be merged (thanks, @jangorecki, #87). 4 | 5 | # CHANGES IN litedown VERSION 0.7 6 | 7 | - `pkg_manual()` will exclude help pages with the keyword `internal` (thanks, @TimTaylor, #78). 8 | 9 | - `pkg_news()` will add links to Github users and issue numbers if the package is hosted on Github. 10 | 11 | - Allow `,` and `.` in superscripts and subscripts (thanks, @janlisec, #81). 12 | 13 | - Special characters in bibliography entries such as `{\"u}` can be correctly read now (thanks, @bastistician). 14 | 15 | - Fixed a bug that inline code expressions (`` `{lang} expr` ``) cannot be correctly located when the line has leading spaces that are not meaningful. 16 | 17 | - Deleted vignettes `markdown-examples` and `markdown-output`. They are rendered on the package site now: https://git.yihui.org/litedown/examples/test-options.html 18 | 19 | # CHANGES IN litedown VERSION 0.6 20 | 21 | - Added a Markdown rendering option `offline` to download web resources when this option is set to true, so that the HTML output can be viewed offline (thanks, @TimTaylor, #73). See https://yihui.org/litedown/#sec:offline for more info. 22 | 23 | - Added a function `get_context()` to query the `fuse()` context such as the input file path or the output format (thanks, @MichaelChirico #67, @vincentarelbundock #70). 24 | 25 | - Added a function `raw_text()` to output raw text content in a code chunk (thanks, @vincentarelbundock, #69). 26 | 27 | - Dropped the chunk option `ref.label` and added a new chunk option `fill`, which is more general (`ref.label = "LABEL"` can be achieved by `` `