Explorar el Código

Add fallback section ID with ToC (#11941)

master^2
Yamagishi Kazutoshi hace 4 años
committed by Eugen Rochko
padre
commit
67bef15e53
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. +1
    -1
      app/lib/toc_generator.rb

+ 1
- 1
app/lib/toc_generator.rb Ver fichero

@@ -45,7 +45,7 @@ class TOCGenerator
parsed_html.traverse do |node|
next unless TARGET_ELEMENTS.include?(node.name)

anchor = node['id'] || node.text.parameterize
anchor = node['id'] || node.text.parameterize.presence || 'sec'
@slugs[anchor] += 1
anchor = "#{anchor}-#{@slugs[anchor]}" if @slugs[anchor] > 1



Cargando…
Cancelar
Guardar