Breaking changes and major new features
This is a major release with multiple breaking API changes, although upgrading shouldn't be too difficult. It fixes bugs and comes with some nice new features.
Breaking changes and upgrading
- The
SyntaxSetAPI has been revamped to use a builder and an arena of contexts. See example usage. - Many functions now need to be passed the
SyntaxSetthat goes with the rest of their arguments because of this new arena. - Filename added to
LoadingError::ParseSyntax - Many functions in the
htmlmodule now take thenewlinesversion of syntaxes.- These methods have also been renamed, partially so that code that needs updating doesn't break without a compile error.
- The HTML they output also treats newlines slightly differently and I think more correctly but uglier when you look at the HTML.
Breaking rename upgrade guide
SyntaxSet::add_syntax -> SyntaxSetBuilder::addSyntaxSet::load_syntaxes -> SyntaxSetBuilder::add_from_folderSyntaxSet::load_plain_text_syntax -> SyntaxSetBuilder::add_plain_text_syntaxhtml::highlighted_snippet_for_string -> html::highlighted_html_for_string: also change tonewlinesSyntaxSethtml::highlighted_snippet_for_file -> html::highlighted_html_for_file: also change tonewlinesSyntaxSethtml::styles_to_coloured_html -> html::styled_line_to_highlighted_html: also change tonewlinesSyntaxSethtml::start_coloured_html_snippet -> html::start_highlighted_html_snippet: return type also changed
Major changes and new features
- Use arena for contexts (#182 #186 #187 #190 #195): This makes the code cleaner, enables use of syntaxes from multiple threads, and prevents accidental misuse.
- This involves a new
SyntaxSetBuilderAPI for constructing newSyntaxSets - See the revamped parsyncat example.
- This involves a new
- Encourage use of newlines (#197 #207 #196): The
nonewlinesmode is often buggy so we made it easier to use thenewlinesmode.- Added a
LinesWithEndingsutility for iterating over the lines of a string with\ncharacters. - Reengineer the
htmlmodule to usenewlinessyntaxes.
- Added a
- Add helpers for modifying highlighted lines (#198): For use cases like highlighting a piece of text in a blog code snippet or debugger. This allows you to reach into the highlighted spans and add styles.
- Check out
split_atandmodify_rangein theutilmodule.
- Check out
- New
ThemeSet::add_from_folderfunction (#200): For modifying existing theme sets.
Bug Fixes
- Improve nonewlines regex rewriting: #212 #211
- Reengineer theme application to match Sublime: #209
- Also mark contexts referenced by name as "no prototype" (same as ST): #180
- keep with_prototype when switching contexts with
set: #177 #166 - Fix unused import warning: #174
- Ignore trailing dots in selectors: #173
- Fix
embedto not include prototypes: #172 #160
Upgraded dependencies
- plist:
0.2 -> 0.3 - regex:
0.2 -> 1.0 - onig:
3.2.1 -> 4.1