react: fix code linebreaks for highlighted lines

Fixes #1247.
pull/1536/head
Simon Legner 4 years ago
parent 0ca4586123
commit c417cecb0c

@ -13,7 +13,13 @@ module Docs
end
css('.gatsby-highlight > pre').each do |node|
node.content = node.content
node.content = node.at_css('code').children.map do |n|
if !n['class'].nil? && n['class'][/gatsby-highlight-code-line/]
n.content + "\n"
else
n.content
end
end.join("")
node['data-language'] = node['class'][/(?<=gatsby\-code\-)(\w+)/]
node.remove_attribute('class')
node.parent.replace(node)

@ -2,7 +2,7 @@ module Docs
class React < UrlScraper
self.name = 'React'
self.type = 'simple'
self.release = '17.0.1'
self.release = '17.0.2'
self.base_url = 'https://reactjs.org/docs/'
self.root_path = 'hello-world.html'
self.links = {

Loading…
Cancel
Save