glitchier-soc/spec
kibigo! 2fbfe4ad92 Use a tree‐based approach for advanced text formatting (#1907)
* Use a tree‐based approach for adv. text formatting

Sanitizing HTML/Markdown means parsing the content into an HTML tree
under‐the‐hood anyway, and it is more accurate to do mention/hashtag
replacement on the text nodes in that tree than it is to try to hack it
in with regexes et cetera.

This undoes the overrides of `#entities` and `#rewrite` on
`AdvancedTextFormatter` but also stops using them, instead keeping
track of the parsed Nokogiri tree itself and using that in the `#to_s`
method.

Internally, this tree uses `<mastodon-entity>` nodes to keep track of
hashtags, links, and mentions. Sanitization is moved to the beginning,
so it should be known that these do not appear in the input.

* Also disallow entities inside of `<code>`

I think this is generally expected behaviour, and people are annoyed
when their code gets turned into links/hashtags/mentions.

* Minor cleanup to AdvancedTextFormatter

* Change AdvancedTextFormatter to rewrite entities in one pass and sanitize at the end

Also, minor refactoring to better match how other formatters are organized.

* Add some tests

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
2022-12-02 10:29:42 +01:00
..
config/initializers Fix rate limiting for paths with formats (#20675) 2022-11-14 20:26:31 +01:00
controllers Merge branch 'main' into glitch-soc/merge-upstream 2022-11-22 10:28:43 +01:00
fabricators png optimization(loss less) (#19630) 2022-11-01 15:06:52 +01:00
features Change public accounts pages to mount the web UI (#19319) 2022-10-20 14:35:29 +02:00
fixtures Support for import/export of instance-level domain blocks/allows for 4.x w/ additional fixes (#20597) 2022-11-17 11:05:09 +01:00
helpers Test the native_locale_name of a non-standard locale (#20284) 2022-11-11 00:06:18 +01:00
lib Use a tree‐based approach for advanced text formatting (#1907) 2022-12-02 10:29:42 +01:00
mailers Add support for language preferences for trending statuses and links (#18288) 2022-10-08 16:45:40 +02:00
models Merge branch 'main' into glitch-soc/merge-upstream 2022-11-22 10:28:43 +01:00
policies Merge branch 'main' into glitch-soc/merge-upstream 2022-10-28 19:23:58 +02:00
presenters Merge branch 'main' into glitch-soc/merge-upstream 2022-10-28 19:23:58 +02:00
requests Change public accounts pages to mount the web UI (#19319) 2022-10-20 14:35:29 +02:00
routing Change public accounts pages to mount the web UI (#19319) 2022-10-20 14:35:29 +02:00
serializers/activitypub Fix account URI in UpdatePollSerializer (#11194) 2019-06-27 19:41:55 +02:00
services Merge branch 'main' into glitch-soc/merge-upstream 2022-11-28 11:33:34 +01:00
support Spelling (#17705) 2022-03-06 22:51:40 +01:00
validators Merge branch 'main' into glitch-soc/merge-upstream 2022-06-10 11:51:43 +02:00
views/statuses Fix style for hashes (#20518) 2022-11-17 11:05:39 +01:00
workers Fix followers count not being updated when migrating follows (#19998) 2022-11-07 15:38:55 +01:00
rails_helper.rb Fix single Redis connection being used across all threads (#18135) 2022-04-28 17:47:34 +02:00
spec_helper.rb Improve tests involving push_bulk (#17508) 2022-02-10 19:42:45 +01:00