You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
Description
I'm using highlights as a library outside of Atom. It works great, except that I noticed that in certain cases it adds trailing <span> </span> at the end of lines.
This is not a problem visually, but when developers are copy-pasting code into their editors, the trailing whitespace will get pasted as well.
Steps to Reproduce
Run the following script:
constHighlights=require('highlights')consthighlighter=newHighlights()construbyCode=`Sequel.migration do change do add_column :photos, :image_data, :text # or :jsonb endend`lethtml=highlighter.highlightSync({fileContents: rubyCode,scopeName: `source.ruby`,})console.log(html)
Expected behavior:
I expect only whitespace to be translated into .
Actual behavior:
Additional trailing character is added after the # or :jsonb comment:
<preclass="editor editor-colors"><divclass="line"><spanclass="source ruby"><spanclass="support class ruby"><span>Sequel</span></span><spanclass="punctuation separator method ruby"><span>.</span></span><span>migration </span><spanclass="keyword control start-block ruby"><span>do</span></span></span></div><divclass="line"><spanclass="source ruby"><span> change </span><spanclass="keyword control start-block ruby"><span>do</span></span></span></div><divclass="line"><spanclass="source ruby"><span> add_column </span><spanclass="constant other symbol ruby"><spanclass="punctuation definition constant ruby"><span>:</span></span><span>photos</span></span><spanclass="punctuation separator object ruby"><span>,</span></span><span> </span><spanclass="constant other symbol ruby"><spanclass="punctuation definition constant ruby"><span>:</span></span><span>image_data</span></span><spanclass="punctuation separator object ruby"><span>,</span></span><span> </span><spanclass="constant other symbol ruby"><spanclass="punctuation definition constant ruby"><span>:</span></span><span>text</span></span><span> </span><spanclass="comment line number-sign ruby"><spanclass="punctuation definition comment ruby"><span>#</span></span><span> or :jsonb</span><span> </span></span></span></div><divclass="line"><spanclass="source ruby"><span> </span><spanclass="keyword control ruby"><span>end</span></span></span></div><divclass="line"><spanclass="source ruby"><spanclass="keyword control ruby"><span>end</span></span></span></div></pre>
I believe this is because highlights converts empty strings into , we can see there is one extra empty string in the list of tokens:
I'm using highlights as a library outside of Atom. It works great, except that I noticed that in certain cases it adds trailing <span> </span> at the end of lines.
Just to mention up front, with our current resources we're specifically not prioritizing issues that aren't causing a problem in Atom. To clarify, is this behavior causing a particular issue in Atom?
Prerequisites
Description
I'm using
highlights
as a library outside of Atom. It works great, except that I noticed that in certain cases it adds trailing<span> </span>
at the end of lines.This is not a problem visually, but when developers are copy-pasting code into their editors, the trailing whitespace will get pasted as well.
Steps to Reproduce
Run the following script:
Expected behavior:
I expect only whitespace to be translated into
.Actual behavior:
Additional trailing
character is added after the# or :jsonb
comment:I believe this is because
highlights
converts empty strings into
, we can see there is one extra empty string in the list of tokens:Reproduces how often:
Every time.
Versions
Highlights 3.1.4
The text was updated successfully, but these errors were encountered: