AntonKhorev left a comment (openstreetmap/openstreetmap-website#5840)

This is a version that modifies the document, consisting of replaced `document` 
method, assuming we don't need to add `dir` on inline elements:

```ruby
    def document
      return @document if @document

      @document = Kramdown::Document.new(self)

      add_dir = lambda do |element|
        target_types = %w[p header pre codeblock ul ol table dl math]
        element.attr["dir"] ||= "auto" if target_types.include?(element.type == 
:html_element ? element.value : element.type.to_s)
        element.children.each(&add_dir)
      end
      add_dir.call(@document.root)

      @document
    end
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5840#issuecomment-2756304298
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/5840/c2756304...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to