Skip to content

Commit 9b627ba

Browse files
authored
fix: Add header to HTMLs req'd by pkgdown (#29)
`pkgdown` generated files rely on `<!-- Generated by pkgdown` being available in the second line of each HTML doc, otherwise they get skipped with this message: `Skipping '<whatever>': not generated by pkgdown` This adds the required 2 lines on top to ensure that the files are regerenated. --------- Co-authored-by: cicdguy <cicdguy@users.noreply.github.com>
1 parent 374687b commit 9b627ba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,13 @@ def process_single_html_file(file_path, dropdown_list):
296296
print(f"❌ {file_path}", file=sys.stderr)
297297
return False
298298

299-
modified_html = etree.tostring(
299+
doctype = "<!DOCTYPE html>\n"
300+
comment = "<!-- Generated by pkgdown + https://github.com/insightsengineering/r-pkgdown-multiversion -->\n"
301+
html_content = etree.tostring(
300302
tree, encoding="unicode", pretty_print=True, method="html"
301303
)
304+
modified_html = doctype + comment + html_content
305+
302306
if not write_file(file_path, modified_html):
303307
return False
304308

0 commit comments

Comments
 (0)