Open etiennebacher opened 2 years ago
Close #149, close #156 (and v2 of #155).
downlit_html() now keeps all pre classes, which allows for customization of code blocks in pkgdown using chunk options class.source and attr.source.
downlit_html()
pre
pkgdown
class.source
attr.source
Current behavior (.my-class and .another-class are dropped):
.my-class
.another-class
library(downlit) html <- xml2::read_xml(" <div> <div class='sourceCode'> <pre class='sourceCode r my-class'> <code class='sourceCode r'> <span>Hello</span> </code> </pre> </div> <div class='sourceCode'> <pre class='sourceCode r another-class'> <code class='sourceCode r'> <span>Hello</span> </code> </pre> </div> </div>") downlit_html_node(html) html #> {xml_document} #> <div> #> [1] <div class="sourceCode">\n <pre class="downlit sourceCode r">\n<code cla ... #> [2] <div class="sourceCode">\n <pre class="downlit sourceCode r">\n<code cla ...
New behavior:
library(downlit) html <- xml2::read_xml(" <div> <div class='sourceCode'> <pre class='sourceCode r my-class'> <code class='sourceCode r'> <span>Hello</span> </code> </pre> </div> <div class='sourceCode'> <pre class='sourceCode r another-class'> <code class='sourceCode r'> <span>Hello</span> </code> </pre> </div> </div>") downlit_html_node(html) html #> {xml_document} #> <div> #> [1] <div class="sourceCode">\n <pre class="downlit sourceCode r my-class">\n ... #> [2] <div class="sourceCode">\n <pre class="downlit sourceCode r another-clas ...
Test failures are unrelated to this PR.
Do you have any updates?
@sgvignali I don't think there's anything more I can do on my side, so I'm just waiting for someone from r-lib to review this
r-lib
Close #149, close #156 (and v2 of #155).
downlit_html()
now keeps allpre
classes, which allows for customization of code blocks inpkgdown
using chunk optionsclass.source
andattr.source
.Current behavior (
.my-class
and.another-class
are dropped):New behavior: