Unified · Split
| @@ -8,12 +8,20 @@ module Docs · 7 unmodified lines | |||
| 8 | @doc = at_css('main article .markdown-body') | 8 | @doc = at_css('main article .markdown-body') |
| 9 | end | 9 | end |
| 10 | 10 | ||
| 11 | if at_css('.text-2xl') | ||
| 12 | doc.prepend_child at_css('.text-2xl').remove | ||
| 13 | at_css('.text-2xl').name = 'h1' | ||
| 14 | end | ||
| 15 | |||
| 11 | css('code').each do |node| | 16 | css('code').each do |node| |
| 12 | if node['class'] | 17 | if node['class'] |
| 13 | lang = node['class'][/language-(\w+)/, 1] | 18 | lang = node['class'][/language-(\w+)/, 1] |
| 14 | end | 19 | end |
| 15 | node['data-language'] = lang || 'ts' | 20 | node['data-language'] = lang || 'ts' |
| 16 | node.remove_attribute('class') | 21 | node.remove_attribute('class') |
| 22 | if node.parent.name == 'div' | ||
| 23 | node.content = node.content.strip | ||
| 24 | end | ||
| 17 | end | 25 | end |
| 18 | 26 | ||
| 19 | css('a.header-anchor').remove() | 27 | css('a.header-anchor').remove() |