Skip to content

Commit

Permalink
remove table headers that are completely empty
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Nov 13, 2024
1 parent 0e0f60c commit 44afb7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# CHANGES IN litedown VERSION 0.5

- Empty table headers are removed in HTML output (they may be generated from data frames or matrices without column names).

- `pkg_manual()` will point out the name of the problematic Rd file when the Rd file fails to convert to HTML (thanks, @BSchamberger).

- Dropped **knitr** and **rmarkdown** from the `Suggests` field in `DESCRIPTION`. Previously, **litedown** allowed `rmarkdown::render()` to use the output formats `litedown::html_format` and `litedown::latex_format`. Now `rmarkdown::render()` is no longer supported, and `litedown::fuse()` must be used instead.
Expand Down
2 changes: 2 additions & 0 deletions R/mark.R
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ mark = function(input, output = NULL, text = NULL, options = NULL, meta = list()
}, 'html', function(z2) gsub(id4, ' ', restore_html(z2)))
# some code blocks with "attributes" are verbatim ones
ret = match_replace(ret, '```+\\{.+}', function(x) gsub(id4, ' ', x, fixed = TRUE))
# remove empty table header
ret = gsub('<thead>\n<tr>\n(<th[^>]*></th>\n)+</tr>\n</thead>\n', '', ret)
# table caption: a paragraph that starts with 'Table: ' or ': ' after </table>
ret = gsub(
'(<table>)(?s)(.+?</table>)\n<p>(Table)?: (?s)(.+?)</p>',
Expand Down

0 comments on commit 44afb7e

Please sign in to comment.