Code blocks are rendered as raw strings and therefore don´t need to be
checked for XSS. Checking them for XSS disallow users to write articles about
XSS in markdown, for example.
Co-authored-by: Mac Siri <mac@forem.com>
This is the least effort I can presently think of to allow for us to
reprocess user article's and handle the scenario in which the user may
have once had permission to the liquid tag but no longer.
This DI is not something I imagine using, but may highlight a better
approach for liquid tag permissions.
Related to #12146 and #16460
* Remove modify_hr_tags method definition
this breaks things that call it.
* Remove direct uses of modify_hr_tags fixer method
Remove from class METHODS lists, remove test cases about this behavior, and remove from
methods lists in test cases.
* Remove hr tag modification spec
Still don't understand what problem this was fixing, but I've removed
the test case.
* Extracting container for allowed tags & attrs
Prior to this commit, we had several different locations in which we
specified ALLOWED_TAGS and ALLOWED_ATTRIBUTES for HTML rendering and
sanitization.
Curious to see how these either intersected or didn't, I opted to
create a container module that allows for us to more readily normalize
these allowed tags and attributes. It's possible that we won't do any
normalization, but this work helps make that easier.
Ideally, I'd love us to contextualize "why did we choose the
tags/attributes we chose?" But for now, I think consolidating these
tags and attributes will help make adding a `details` and `summary` tag
easier.
This relates to forem/rfcs#296
See [Google Sheet][1] for analysis of what tags/attributes are used, the
intersection and union.
[1]:https://docs.google.com/spreadsheets/d/1yj-a1qus1o0o4cj-_gOMP5yteeg-_f3s5z7kvK0Y7RM/edit#gid=0
* Fixing misnamed constant
* Fixing misnamed constant
* Extracting additional HtmlRendering use cases
* Adding comparative documentation for HTML tags
* Fixing broken parameter signature
* Moving constants into MarkdownProcessor
* Add option for triple tildes for fenced codeblocks
Note that this doesn't account for all triple backticks in fenced codeblocks situations.
* Add commented out but failing test case for the future?
* Add tests from QA instructions
* Remove definitely unused attributes
* Refactor and remove unused attributes
* Add parentheses
* Prevent alt tag from having Liquid tags inside
* Add test
* Remove more unused attributes
* Scrub any valid attributes
* Remove unused tags and add more tests
* Remove <i> tag; <em> is used by parser
* Remove <center> b/c it's deprecated though still valid
* <cite> is a safe tag and used by some
* Eh I changed my mind about center lol
* Add underline <u> back in
* Don't allow width changes
* Use frozen constant for regex
* Use #remove over #gsub
* Create a new method that replaces <code> tags to
triple back ticks (```)
* Create unit tests for add_proper_code_tags method
* Rubocop fixes
* Change method name to one that is more descriptive/accurate
Fix method to allow for triple backticks, sameline code tags and multiline codetags in the same post/article
Fix test to match with method name change
* Fix rubocop offenses
* Fix Rubocop offenses
* Add additional assertions to make sure backticks are present
* Create new MarkdownProcessor::Fixer services
* Remove old MarkdownFixer
* Code cleanup
* Capitalize Base in code comments
* Remove comments related to inheritance
* Add fix_methods method to hold METHDOS constant