Skip to content
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

Encourage use of lines with newline characters #196

Closed
1 of 4 tasks
trishume opened this issue Aug 4, 2018 · 1 comment · Fixed by #207
Closed
1 of 4 tasks

Encourage use of lines with newline characters #196

trishume opened this issue Aug 4, 2018 · 1 comment · Fixed by #207

Comments

@trishume
Copy link
Owner

trishume commented Aug 4, 2018

I'd like to change the HTML APIs and the doc examples to use the newlines version of the syntax sets. The nonewlines version is a hack and sometimes provides incorrect results.

Here's my proposed plan:

  • @robinst can you contribute your iterator from your Stack Overflow post to syntect under the easy or util module with a doc comment explaining how it lets you use the newlines version with strings? Stack Overflow's default license isn't compatible with me copy-pasting it AFAIK.
  • Use that iterator in the html::highlighted_snippet_for_string and the IO with newline reader loop in highlighted_snippet_for_file.
  • Rename both of those methods, not because they particularly need renaming but so that people upgrading don't miss the breaking change and get subtly broken behaviour.
  • Change all the examples to use the newlines version of the syntax sets as required
@robinst
Copy link
Collaborator

robinst commented Aug 6, 2018

Good idea! Raised a PR for the first point.

We should also change the docs for load_defaults_nonewlines and load_defaults_newlines so the documentation for load_defaults_newlines is the main one, and the other one refers to it. At the moment, the docs make it sound like the "nonewlines" is the main one:

/// Same as `load_defaults_nonewlines` but for parsing line strings with newlines at the end.

trishume added a commit that referenced this issue Aug 7, 2018
Add `LinesWithEndings` util for iterating over lines (#196)
trishume added a commit that referenced this issue Sep 12, 2018
Use newlines syntaxes in HTML and docs, fixes #196
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants