Comments (6)
@codingtwinky I can see the idea, but I do not think I completely understand what you need.
From what I understand for the expand part of the code, it would be enough if I received either the files source or their path in the system.
The other feature you mentioned I did not quite understand.
If the idea is just to inject new lines in the diff I can see two ways of doing it:
- Receive the extra lines when parsing and create the whole HTML with hidden parts that can be showed later
- We parse the diff normally, and then when someone clicks to expand the diff we generate lines on demand and some JavaScript can inject those lines in the middle of the diff.
Do you have any other suggestions?
Is this what you need?
from diff2html.
That would work for this specific feature, but to keep in more generic and workable, I guess what I had in my mind is an easy way to inject additional codes in various places.
I originally thought about doing something like how templating languages work, but now that I have laid out this thought and think more and more I'm not sure if I like this approach.
We may have to give up and derive our own getPrettyHtml
functions using diff json or hijack and override some of the function within ungit.
i.e.
<tbody class="d2h-diff-tbody">
<tr>
<td class="d2h-code-linenumber d2h-del">
...
</td>
<td class="d2h-del">
<div class="d2h-code-line d2h-del">
<span class="d2h-code-line-prefix">
-
</span>
<span class="d2h-code-line-ctn">
...
</span>
</div>
</td>
</tr>
</tbody>
Can be transformed to something like this below with lots of hints for me to easily replace and transform html.
<tbody class="d2h-diff-tbody" diff-file-name="a/b.txt">
<!-- diff2html start-file-diff -->
<tr line-number="23">
<!-- diff2html start-line-diff -->
<td class="d2h-code-linenumber d2h-del">
...
</td>
<!-- diff2html mid-line-diff -->
<td class="d2h-del">
<div class="d2h-code-line d2h-del">
<!-- diff2html start-line-diff-detail -->
<span class="d2h-code-line-prefix">
-
</span>
<!-- diff2html mid-line-diff-detail -->
<span class="d2h-code-line-ctn">
...
</span>
<!-- diff2html end-line-diff-detail -->
</div>
</td>
<!-- diff2html end-line-diff -->
</tr>
<!-- diff2html end-diff -->
</tbody>
from diff2html.
@codingtwinky the HTML transformation looks good to me.
If you want to do some changes and add more functionality I am always available to accept any pull request.
from diff2html.
@codingtwinky, After thinking a little bit more about this, I am considering to have some kind of add-ons that would act on the content to do extra behavior:
-
Lazy loading content:
Instead of invoking the generate html for all the content, parse the diff and invoke file by file as the page goes down.
-
Expanding files:
Inject some JS triggers to generate more context lines
It would be a good idea to have some kind of pipe and filter, after json generation, before html generation, ..
Still it is kind of a big change, do you think this could help your needs?
from diff2html.
It would definitely help but I absolutely agree that it is a big change and I'm not sure if I can selfishly ask for such big changes for us only. As I think more and more I may just ask for more modularized and easy to extend object structure that we can override the certain key functions.
I will try several things and will request or send PRs as things come up.
from diff2html.
@codingtwinky ok. I do not mind any features prs.
from diff2html.
Related Issues (20)
- side-by-side way too wide for wide diffs HOT 3
- How to set tag status HOT 2
- side-by-side diff is broken in Firefox HOT 2
- Output of diff not preserving escaped HTML characters HOT 3
- Can't run diff2html-cli on linux docker container HOT 2
- Make templates more flexible HOT 4
- How to remove the serial number of blank lines HOT 3
- Blank context lines are ignored by diff parser HOT 1
- Vertical align mismatch between inserted/deleted text and matching
- Code breaking when there is no change in a line HOT 3
- Is it possible to generate single html report for multiple git repos? HOT 1
- Unknown argument: diff.txt HOT 1
- 12341
- Suggest new option to Diff2Html library HOT 1
- If the diffString contains special symbols, the page will report an error HOT 1
- Diff2html fails with Error: Cannot find module 'tslib'
- Slim version doesn't fallback to 'plaintext' on unsupported file type HOT 4
- File list links are not working in Angular integration for diff2html-ui HOT 2
- the `multiline comment` syntax can not highlight correctly HOT 1
- CSS not working inside shadow DOM
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diff2html.