html: enable providing custom html page templates#5694
Conversation
dberenbaum
left a comment
There was a problem hiding this comment.
LGTM. Another alternative would be to have a cdn-path or vega-base path or something that would replace the url used for all the vega scripts. We may end up revisiting the plots in the near future to address some of the other enhancements discussed, so whatever you and @JIoJIaJIu think is best for now.
There was a problem hiding this comment.
Is this print statement intended to stay in here?
17c5def to
7579738
Compare
0f1103a to
22c5916
Compare
|
Added config option for html_template, here is the sample script modified to use new option: Please note the fact that in this case using full paths in HTML template is necessity, that's the only way to make sure custom template works regardless where do we call |
|
Fixes #5679 |
There was a problem hiding this comment.
Post-merge discussion per treeverse/dvc.org#2402 (comment) 👇
| # enabled by default. It's of no use, kept for backward compatibility. | ||
| Optional("parametrization", default=True): Bool | ||
| }, | ||
| "plots": {"html_template": str}, |
There was a problem hiding this comment.
Should it be just plots.html? To avoid overloading the term "template" (also associated with Vega customizations).
| parser.add_argument( | ||
| "--html-template", |
There was a problem hiding this comment.
Similarly, should it be just --html?
❗ I have followed the Contributing to DVC checklist.
📖 If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
ref: Update
dvc plotsto include information about offline HTML plots dvc.org#2402Thank you for the contribution - we'll try to review it as soon as possible. 🙏
Initial implementation allowing custom HTML webpage template.
I decided just to allow users provide their own HTML, as long as there is
{plot_divs}format string inside, so that we don't have to deal with additional args like--vega-path--vega-lite-path--vega-embed-pathwhich would be necessary if we were to handle the template on our own, indvccode.How one can utilize new functionality :
For sake of simplicity there is only
--html-templateoption. However if we decide to go this way (allowing users to provide their own HTML template) I will prepare properdvc configcommand, that would allow doing the setup only once per project.cc @JIoJIaJIu @mnrozhkov @dberenbaum