Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
591 views
in Technique[技术] by (71.8m points)

ember.js - How to prettify commit diff returned from Github API request on a web UI

I'm using the Github API to make a request to get the diff between 2 commits. I'm using the diff media type and getting the diff back as a string. This is all working fine, except now I'm challenged with having to display this diff on the web UI that I'm building (its in Ember). The desired outcome is to have additions colored in green and deletions shown in red. I'm guessing if there's no existing libraries or addons that do this, I might need to do some regex looking for +'s and -'s and then applying styles dynamically to the matched substrings, but that seems like a shakey idea (what if there are + or - in the code itself?).

Has anyone tackled this before? I don't know if I haven't found the right search term, but I can't seem to find any information on how to do this.

question from:https://stackoverflow.com/questions/65928877/how-to-prettify-commit-diff-returned-from-github-api-request-on-a-web-ui

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...