The discussion revolves around a bug where multi-line strikethrough in Discourse fails to properly cover quoted text, with the preview showing correct rendering but the final output not. Users alexs, codinghorror, and mattman highlight the inconsistency between preview and final render. sam explains the issue stems from Nokogiri’s handling of inline <s> tags in flow content, noting that browsers apply a workaround by copying the tag across paragraphs, while Nokogiri closes it at the end of each paragraph. Fabby files a bug with Nokogiri, which redirects to libxml2, and suggests alternatives like Gumbo. sam confirms that the issue is being addressed, and Fabby later confirms it’s resolved, with a working example shown.
I’m not sure whether this bug is specific to Discourse but when I try to strikethrough several lines of text & one of those lines is a quote, the quote’s text is not struck out.
The preview displays the quoted text as struck out -
Thanks, but I wasn’t asking for a work around. I was pointing out that this bug still exists. It’s weird that the preview gets it right but the actual render doesn’t.
I’m not so sure this is a bug. Phrasing content can’t be expected to work well with Flow content that is not itself Phrasing content. eg. <div> or <p> tags.
What would be required is to parse the single opening and closing <s> tags to multiple tags within the parent Flow content elements.
IMHO, that is most likely a bit much for something that is edge case and has an existing workaround.
What’s happening is the browser is applying an age-old fix by copying the <s> onto each paragraph until the close tag. The server uses Nokogiri which does not Reconstruct the active formatting elements but instead inserts a close tag for the strikethrough at the end of paragraph, as you would for any non-formatting mis-nested tag.
It’s officially specified as applying to a, b, big, code, em, font, i, nobr, s, small, strike, strong, tt, and u.
I am not against somebody submitting a patch nokogiri that works around this issue, or gives it a mode where it is able to handle it and we use it.
But I am moving this to feature … cause technically you provided bad HTML, if anyone is passionate about this raise it on the CommonMark site or Nokogiri bug tracker.
Понятно. И если группа Nokigiri реализует эту просьбу, со временем это дойдет и до Discourse. Так что, не могли бы вы предоставить:
nokogiri -v
результат выполнения, так как мне нужно добавить это в описание ошибки, как вы и команда Nokigiri просили, потому что с точки зрения конечного пользователя это сейчас выглядит как обман в Discourse:
Я не поддерживаю изменение nokogiri. Если это необходимо из-за множества жалоб от клиентов, мы можем очистить эти элементы, чтобы превью соответствовало, или открыть баг-репорты в Chrome и Firefox.
@sam В соответствии с обсуждением вне сети, был открыт вопрос в nokogiri, где нам сообщили, что на самом деле это CRuby использует libxml2.
Поэтому был открыт новый вопрос в репозитории libxml2, чтобы в конечном итоге это было включено в nokogiri, а затем в Discourse, и @alexs, @codinghorror, @mattman, @Mittineague, @riking смогут быть ещё счастливее, когда зачёркивание будет работать на нескольких строках.
Приношу извинения всем за такую педантичность, но:
Легкие люди адаптируются к своей среде, тогда как сложные люди настаивают на том, чтобы их среда адаптировалась к ним. Следовательно, весь человеческий прогресс — от приручения огня, колеса, пирамид, пенициллина… до принуждения электронов проходить через квантовый туннель для создания SSD-накопителей можно приписать сложным людям!