|
|
@ -8,12 +8,20 @@ module Docs
|
|
|
|
@doc = at_css('main article .markdown-body')
|
|
|
|
@doc = at_css('main article .markdown-body')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if at_css('.text-2xl')
|
|
|
|
|
|
|
|
doc.prepend_child at_css('.text-2xl').remove
|
|
|
|
|
|
|
|
at_css('.text-2xl').name = 'h1'
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
css('code').each do |node|
|
|
|
|
css('code').each do |node|
|
|
|
|
if node['class']
|
|
|
|
if node['class']
|
|
|
|
lang = node['class'][/language-(\w+)/, 1]
|
|
|
|
lang = node['class'][/language-(\w+)/, 1]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
node['data-language'] = lang || 'ts'
|
|
|
|
node['data-language'] = lang || 'ts'
|
|
|
|
node.remove_attribute('class')
|
|
|
|
node.remove_attribute('class')
|
|
|
|
|
|
|
|
if node.parent.name == 'div'
|
|
|
|
|
|
|
|
node.content = node.content.strip
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
css('a.header-anchor').remove()
|
|
|
|
css('a.header-anchor').remove()
|
|
|
|