-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render markdown tables in legislation draft #5136
Render markdown tables in legislation draft #5136
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @karim-semmoud
Thanks a lot for this pull request! 🎉
I've left a couple of comments. Let me know what you think!
Hi @taitus 1 -How about using click_link "Launch text editor" instead of click_link class: "fullscreen-toggle" in this test? 2 -At Consul we try to avoid putting comments in the code, the commit message might be a good place to add this reference to the options offered by RedCarpet thinking 3-Table CSS I will make the changes necessary and commit them Extra Note: |
This comment made me wonder why we've got two different ways of rendering markdown, with only one of them enabling certain extensions. Maybe it made sense before we stopped storing the generated HTML in the database but, if so, I think we can now unify the code 🤔. @karim-semmoud @taitus Do you think it'd make sense? Here are a couple of commits that make the 0001-Use-the-same-extensions-in-all-markdown-renderers.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karim-semmoud I've left a small comment; other than that, could you squash the first four commits of this pull request (all the commits except the ones I've posted in another comment) into one, since there are three commits that basically fix the first one?
Thanks a lot!
459fe42
to
1be2430
Compare
* Add Tables option to Redcarpet in Legislation draft * Allow table tags in Admin Legislation Sanitizer * Add Test to render markdown tables in Legislation drafts * Add Test for Admin Legislation Sanitizer We include test for image, table and h1 to h6 tags and additional tests to strengthen the allowed and disallowed parameters * Add Table from markdown test in System and Factories * Add test to render tables for admin user * Remove comment line about Redcarpet options * Edit custom css for legislation draft table to make it responsive
We were using two different sets of extensions but, since the markdown code is always written by administrators, IMHO it makes sense to be consistent and always render markdown code the same way.
This way it'll be easier for other Consul installations to overwrite parts of the code, like the default options.
1be2430
to
af618ea
Compare
@javierm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karim-semmoud Once again, thank you very much for your contributions!
Reference
Markdown not rendering correctly #5135
Objectives
This pull request aims at fixing the display of tables in the Legislation Draft from as a user, it also add test in order to make sure that the tables are rendered.
1- Allow table tags in Admin Legislation Sanitizer
2- Add Tables option to Redcarpet in Legislation draft
We used render_options and extensions variable in order to align with the existing code at app/helpers/application_helper.rb
3- Add custom CSS for Table inside Legislation draft using global table variables. we also make the table responsive with scrolling
4- Add Test to render markdown tables in Legislation drafts as a user and as an admin
5- Add Test for Admin Legislation Sanitizer. We also strengthen allowed and not allowed parameters
Visual Changes
Notes