Simplify Interface (from 2.0 Roadmap)
From the Roadmap
-
Simplify the interface by only doing one thing, accepting an HTML string, a CSS string and inlining it.
a. The options currently in 1.8.0 are now documented so we can evaluate what should exist in 2.0
b. There are some vagaries around exactly how the CSS should be inlined, HTML Entities, UTF-8 encoding, base URLs, and such that lead to the contradictory mess that exists in 1.8
From my perspective nailing this down is the most important task towards doing any dev work done towards a 2.0 release.
Given the API Premailer(html_string, css_string, options = {}), what options are still necessary? Are we still planning to target just Nokogiri and Nokogumbo?
These are the options as documented currently. Which are still necessary? This is my first draft, after a cursory read through the repo.
- [ ] Fixnum :line_length Line length used by to_plain_text. Default is 65.
- [ ] Fixnum :warn_level What level of CSS compatibility warnings to show (see {Premailer::Warnings}).
- [x] String :link_query_string A string to append to every
a href=""link. Do not include the initial?. - [ ] String :base_url Used to calculate absolute URLs for local files.
- [ ] Array(String) :css Manually specify CSS stylesheets.
- [x] Boolean :css_to_attributes Copy related CSS attributes into HTML attributes (e.g. background-color to bgcolor)
- [ ] String :css_string Pass CSS as a string
- [x] Boolean :remove_ids Remove ID attributes whenever possible and convert IDs used as anchors to hashed to avoid collisions in webmail programs. Default is false.
- [x] Boolean :remove_classes Remove class attributes. Default is false.
- [x] Boolean :remove_comments Remove html comments. Default is false.
- [x] Boolean :remove_scripts Remove
scriptelements. Default is true. - [x] Boolean :reset_contenteditable Remove
contenteditableattributes. Default is true. - [x] Boolean :preserve_styles Whether to preserve any
link rel=stylesheetand style elements. Default is false. - [x] Boolean :preserve_reset Whether to preserve styles associated with the MailChimp reset code. Default is true.
- [ ] Boolean :with_html_string Whether the html param should be treated as a raw string. Default is false.
- [x] Boolean :verbose Whether to print errors and warnings to
$stderr. Default is false. - [ ] Boolean :io_exceptions Throws exceptions on I/O errors.
- [x] Boolean :include_link_tags Whether to include css from
link rel=stylesheettags. Default is true. - [x] Boolean :include_style_tags Whether to include css from
styletags. Default is true. - [x] String :input_encoding Manually specify the source documents encoding. This is a good idea. Default is ASCII-8BIT.
- [x] Boolean :replace_html_entities Convert HTML entities to actual characters. Default is false.
- [x] Boolean :escape_url_attributes URL Escapes href, src, and background attributes on elements. Default is true.
- [x] Symbol :adapter Which HTML parser to use, either
:nokogiri,:nokogumboor:hpricot. Default is:nokogiri. - [x] String :output_encoding Output encoding option for Nokogiri adapter. Should be set to "US-ASCII" to output HTML entities instead of Unicode characters.
- [x] Boolean :create_shorthands Combine several properties into a shorthand one, e.g. font: style weight size. Default is true.
For b. can anyone elaborate on what the expected behavior is supposed to be?
@dropofwill do you like to become maintainer? I have no time
I feel a little awkward jumping in like this without even making a PR yet, but I do plan on moving forward with these 2.0 changes (as well as looking into performance), so if none of the current contributors is able to I'd be willing (it'd be nice to keep updates in a single code base).