Commit graph

235 commits

Author SHA1 Message Date
Eric Cornelissen
4dae65d5c7 feat: enable sticky file headers by default
Update the stickyFileHeaders default value to `true` so that it is
enabled by default. Also correct the name of this option in the
documentation by adding the missing trailing "s".
2022-10-31 09:47:31 +01:00
Rodrigo Fernandes
5ca9d22276 fix side by side margins and highlight usage of object instead of map 2022-10-30 20:31:33 +00:00
Eric Cornelissen
7d4a5dce6f feat: sticky file headers
Add support for sticky file headers by adding a `stickyFileHeaders`
option to the `Diff2HtmlUI`. By default this feature is disabled. Also
document this option in the README.

The feature is implemented through an optional CSS class on top of the
pre-existing `.d2h-file-header` class. The new class is added on all
file headers if the option is set to `true` (or the `stickyFileHeaders`
method is called).

This class, `.d2h-sticky-header`, has the minimum amount of styling to
get the desired effect. The `position` and `top` values make the headers
stick to the top as long as the wrapper is in the view. The `z-index`
value is needed to ensure the header is displayed over all other content
in the wrapper. In particular, from my testing in Firefox (106.0.2), the
line numbers would display over the header if the `z-index` value isn't
set.
2022-10-30 13:05:53 +01:00
Rodrigo Fernandes
5373ae180b add support for language override 2022-10-23 18:26:19 +01:00
Rodrigo Fernandes
a09d50a94f bump dependencies 2022-10-16 00:01:01 +01:00
Evan Bovie
a3a0385991 fix prettier complaint 2022-08-25 19:51:21 +00:00
Evan Bovie
a5e2fab2f1
Fix file collapse UI regression
Increase specificity of .d2h-d-none selector
2022-08-25 12:09:43 -07:00
森 雅希
41037b20f3 Set display:flex to align inline-block elements 2022-07-13 19:16:07 +09:00
Rodrigo Fernandes
72b0610d2c
bump: Update all dependencies 2021-10-15 21:29:07 +01:00
Rodrigo Fernandes
e44b4b1363
fix: Add language mappings for highlight.js 2021-09-03 23:26:31 +01:00
Rodrigo Fernandes
7253dbb900 fix: Remove display block to allow hidding file contents 2021-09-01 15:39:34 +00:00
Rodrigo Fernandes
6572b68bf2
bump: Update dependencies 2021-07-23 21:50:00 +01:00
Rodrigo Fernandes
6ad7f00be2
clean: Improve git diff support 2021-07-09 22:35:27 +01:00
Mohamed Akram
ac9e2ce706 Remove redundant HTML classes 2021-05-29 02:08:47 +04:00
Pierric Cistac
bf7b52ad30
regroup handling of diffMaxLineLength and diffMaxChanges in parser 2021-03-11 18:17:33 -05:00
Pierric Cistac
a4e619efa4
feature: new diffMaxLineLength
Mark a file diff as too big if diff line length > threshold
2021-03-11 18:10:14 -05:00
Rodrigo Fernandes
38a9d8f93e
Merge pull request #365 from huggingface/diff-max-lines
feature: bypass parsing/rendering of file diff if specific threshold is crossed
2021-03-04 22:41:02 +00:00
Pierric Cistac
7668889493
fix: only display "Viewed" checkbox if fileContentToggle is set 2021-03-01 17:17:08 -05:00
Pierric Cistac
a65a3b9562
update tests 2021-03-01 16:05:12 -05:00
Pierric Cistac
f220ca11e4
move everything inside parser 2021-03-01 14:48:12 -05:00
Pierric Cistac
5915ecdaa1
feature: display message instead of diff if isTooBig is true
A default `Diff too big to be displayed` message is rendered for any file diff where `isTooBig` is `true`.

A new `diffTooBigMessage` option in render config allows to fully customize the message and receives the file index in the diff as an argument. It can be used to render a link to the raw file diff for example.
2021-02-25 14:08:18 -05:00
Pierric Cistac
ea9c1fee48
feature: new diffMaxChanges in parser config
If `diffMaxChanges` is set in parser config, and its value is exceeded for a given file diff, then parsing for this file is stopped, and `isTooBig` is set to `true` in the `DiffFile`
2021-02-25 14:02:43 -05:00
Civan Yavuzsen
9e831469a5 fix: remove unnesesary height property in d2h-files-diff class 2021-02-07 03:27:57 +03:00
Rafael Cortês
242fc5ae7b
feature: Add selected state style 2021-01-23 22:32:50 +00:00
Rafael Cortês
49bf898e0e
clean: Refactor font style 2021-01-23 22:18:03 +00:00
Rafael Cortês
8ee76bf44b
clean: Refactor function to toggle file contents 2021-01-23 22:16:25 +00:00
Rafael Cortês
316803df77
feature: Hide viewed files 2021-01-23 15:07:14 +00:00
Rodrigo Fernandes
33076dc13e
fix: Add review suggestions 2020-10-29 09:01:09 +00:00
Rodrigo Fernandes
2d4c293a27
fix: Only allow selection line content instead of parent element 2020-10-27 20:06:45 +00:00
Rodrigo Fernandes
27bfd3c987
bump: Update dependencies 2020-09-04 19:21:39 +01:00
Rodrigo Fernandes
426d9ed2a5
bump: Update dependencies 2020-08-15 15:09:15 +01:00
Rodrigo Fernandes
a61c7cfd43
fix: Enforce escape for lines that are not highlighted 2020-07-26 13:56:26 +01:00
campersau
406be9f02a escape diff headers for html 2020-06-27 20:11:28 +02:00
Rodrigo Fernandes
ae91dcedd0
bump: Update highlight.js 2020-05-09 12:36:23 +01:00
Rodrigo Fernandes
ea5129b888
bump: Update dependencies specially acorn and minimist 2020-03-14 20:43:04 +00:00
Rodrigo Fernandes
76fb5227af
fix: Add missing dot in class query selector 2020-03-10 18:16:04 +00:00
Rodrigo Fernandes
05c774139a
fix: Skip selection of structural lines in side diff 2020-02-09 19:06:44 +00:00
Rodrigo Fernandes
7be6ef0f4d
fix: Allow selection of empty lines 2020-02-09 17:07:22 +00:00
Rodrigo Fernandes
bdd88f4b90
fix: Add missing padding to side by side line numbers 2020-02-09 16:21:06 +00:00
Rodrigo Fernandes
ee58e2d700
feature: Implement smart selection in CSS 2020-02-09 16:08:58 +00:00
Rodrigo Fernandes
076e14400b
clean: Remove as type casts and use runtime typechecks with fallback when possible 2020-01-25 23:49:53 +00:00
Rodrigo Fernandes
fe8365bcc1
clean: Replace enums with string or type and object 2020-01-25 23:49:17 +00:00
Rodrigo Fernandes
42c8e26ff4
clean: Add typings for highlight.js languages 2020-01-12 02:24:16 +00:00
Josh Goldberg
eca5b3cfd8 Point of comparison for export = hljs types 2020-01-11 00:14:41 -05:00
Rodrigo Fernandes
db48e96dca
Merge pull request #274 from rtfpessoa/improve-highlightjs-types
clean: Improve highlight.js types
2020-01-10 22:49:38 +00:00
Rodrigo Fernandes
8b5111f8de
clean: Improve diff2html-ui APIs for standalone usage 2020-01-08 22:40:46 +00:00
Rodrigo Fernandes
3c3f528815
clean: Improve highlight.js types 2020-01-05 23:46:32 +00:00
Rodrigo Fernandes
dc9c866041
clean: Improve build configurations 2020-01-01 19:51:36 +00:00
Rodrigo Fernandes
c3c5f60c0d
test: Use Jest snapshots 2019-12-22 19:52:51 +00:00
Rodrigo Fernandes
4a159277a2
clean: Prepare for pre release 2019-12-22 18:47:20 +00:00
Rodrigo Fernandes
8f1208eb01
refactor: Unify line-by-line and side-by-side 2019-12-22 18:35:05 +00:00
Rodrigo Fernandes
5c35de28eb
refactor: Separate matching in side-by-side algorithm 2019-12-22 18:04:52 +00:00
Rodrigo Fernandes
d8e0a99070
refactor: Separate matching in line-by-line algorithm 2019-12-22 18:01:01 +00:00
Rodrigo Fernandes
a25d06a8d7
refactor: Extract matching algorithm in line-by-line diff 2019-12-22 18:00:59 +00:00
Rodrigo Fernandes
0f08c85938
refactor: Unify escaping 2019-12-22 18:00:57 +00:00
Rodrigo Fernandes
f8f5c10c57
refactor: Generators 1 2019-12-22 18:00:55 +00:00
Rodrigo Fernandes
ef1ccb093e
refactor: Use lambda functions for map instead of anonymous functions 2019-12-22 18:00:53 +00:00
Rodrigo Fernandes
7b1727dc74
refactor: Refactor build to use webpack 2019-12-22 18:00:52 +00:00
Rodrigo Fernandes
4200bd7a3b
refactor: Move types and use enums 2019-12-22 18:00:50 +00:00
Rodrigo Fernandes
f72ee2ea46
wip: tweaks to website 2019-12-22 18:00:48 +00:00
Rodrigo Fernandes
4f607633dd
wip: Code and Tests working 2019-12-22 18:00:45 +00:00
Rodrigo Fernandes
a8b9b2b49a
refactor: Initial migration to typescript 2019-12-22 17:58:43 +00:00
Rodrigo Fernandes
a047423f4e
fix: Side by side line spacing
Fixes https://github.com/rtfpessoa/diff2html/issues/251
2019-12-22 17:50:22 +00:00
Rodrigo Fernandes
a5c4b2d219
bump: Bundle typings 2019-10-05 11:18:17 +01:00
Rodrigo Fernandes
53958687a6
fix: Bring char by char option back 2019-10-05 10:47:43 +01:00
Eugene Marcotte
f68f930dd2 Expose oldName and newName to file list templates 2019-07-09 14:28:52 -04:00
Koki Oyatsu
5bf0575b46 Replace space to   for HTML Rendering.
Reason:
Some javascript frameworks(ex. vue.js) manipulate HTML tags when drawing.

At that time, if there is a space-only DOM element, the space in the DOM
element is deleted.

Before:
`` `
<span> </span>
`` `

After (space deleted)
`` `
<span></span>
`` `

In order to avoid this, it has been modified to render with &nbsp; only when there is no diff.
2019-07-07 02:39:50 +09:00
Rodrigo Fernandes
d131860324
fix: Update typescript typings and default configuration options 2019-07-03 20:42:33 +01:00
Rodrigo Fernandes
3c06b401b9
feature: Add maxLineSizeInBlockForComparison to avoid OOM
Fixes #220
2019-06-14 17:10:31 +01:00
Rodrigo Fernandes
07f94aeb9e
fix: Remove lodash.merge for merge 2019-05-08 23:42:42 +01:00
Rodrigo Fernandes
1bb5a0bbdd
Merge pull request #215 from rtfpessoa/fix-linenumbers-on-scroll
Fix linenumbers on scroll
2019-05-01 13:34:02 +01:00
Rodrigo Fernandes
4418f5f00a
fix: Line numbers when scrolling 2019-05-01 13:31:21 +01:00
Mohamed Akram
e4e0df62b9 Preserve tabs 2019-04-15 20:26:32 +04:00
Nick Brewer
9c30d10b97 Fix trailing comma lint issue. 2019-01-31 18:18:24 -06:00
Nick Brewer
b43cc1ae91 Add configuration option to disable the render of templates.
No template would render if the diff shows no difference in its comparison.
2019-01-31 17:58:48 -06:00
Rodrigo Fernandes
65f24c5674
Merge pull request #187 from starpit/lodash.merge
fix: trim lodash dependence down to lodash.merge
2019-01-04 23:30:03 +00:00
Nick Mitchell
cc3083710e fix: trim lodash dependence down to lodash.merge
Fixes #186
2019-01-02 20:45:28 -05:00
Rodrigo Fernandes
7fbc8c238a
Improve line-height 2018-11-18 15:38:46 +00:00
stockmind
a222ff624c Target and style blank lines in side-by-side view 2018-11-14 22:18:39 +01:00
wesssel
ffbb530f81 load merge from lodash instead of whole module 2018-01-10 18:07:46 +09:00
Rodrigo Fernandes
16d63a92ab
Fix diff generation for long lines 2017-10-16 23:44:00 +01:00
romellem
5215321466 Fixes regex for timestamps to when behind GMT
Currently, a timezone that ends in say '+0200' will get stripped, but a
timezone _behind_ GMT will not (so a timezone in the United States of
say, '-0400' will **not** get stripped.

This regex change fixes that.
2017-10-09 09:34:55 -05:00
Rodrigo Fernandes
267748f967
Fix escaping in header lines 2017-03-18 00:11:55 +00:00
Rodrigo Fernandes
523f2109fc
Expose synchronised scroll in the UI helper api 2017-01-15 18:36:12 +00:00
Rodrigo Fernandes
22b9783d07
Update hljs to 9.8.0 2016-12-11 15:22:08 +00:00
Rodrigo Fernandes
0f2d650436
Parse binary patch diffs 2016-12-01 16:39:01 +00:00
Paulo Bu
a481fad7ca Remove timestamps from filenames in unified diffs 2016-10-25 13:48:00 +02:00
Rodrigo Fernandes
f3cadb9667
Allow uncompiled templates 2016-10-15 13:31:02 +01:00
Rodrigo Fernandes
2aaae31cc2 Initial template override support 2016-10-15 13:00:31 +01:00
Rodrigo Fernandes
2a18c91e70
Add another way to recognize binary file names 2016-10-08 15:55:30 +01:00
Rodrigo Fernandes
d3b053cae0
Force inputFormat on ui helper since it is always json 2016-09-18 22:06:29 +01:00
Rodrigo Fernandes
7290650a08
Fix line height not matching between right and left side 2016-09-10 14:57:53 +01:00
Rodrigo Fernandes
f43e03e785
Fix docs offline and fix css typo 2016-09-10 13:30:51 +01:00
Rodrigo Fernandes
6a47f8f3a5
Fix convert &nbps; to proper white spaces with white-space wrap 2016-09-05 22:34:18 +01:00
Rodrigo Fernandes
ed8d33930d
Fix git diff with renames and hunk headers
When we have the file names we consider that the file is already past
the hunk header (@@) and since the renames were setting the names
before the diff was confused.
To fix this I kind of hacked a solution that only uses the rename
file paths if there is no hunk header comming.
We need to find a better way to decide when to start new hunk, finish
files etc
2016-09-02 17:45:35 +01:00
Rodrigo Fernandes
e9e3d928ea
Only log failed hunk header parse if line starts with @@ 2016-07-12 18:44:09 +01:00
Rodrigo Fernandes
9bbc87ae89
Fix parsing of binary files 2016-07-12 16:18:42 +01:00
Rodrigo Fernandes
2f53bf777e
Use ESLint instead of JSCS 2016-07-12 13:47:29 +01:00
Rodrigo Fernandes
f2858f6c45 Fix parsing in cases where body lines can be confused with header lines 2016-06-28 22:15:03 +01:00
Rodrigo Fernandes
7c79cc32db Fix parsing body lines starting with --- and +++ 2016-06-27 21:13:25 +01:00