-
Notifications
You must be signed in to change notification settings - Fork 127
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
Highlight deleted code #515
Highlight deleted code #515
Comments
Thanks for capturing this feature request @peterfriese! You're correct that the renderer currently only supports highlighting the added lines. I'm going to transfer this issue to the swift-docc repository since I believe that we would need compiler/JSON changes in order to properly support highlighting deleted lines. |
For anyone interested, this should be implemented here https://github.com/apple/swift-docc/blob/main/Sources/SwiftDocC/Model/Rendering/Tutorial/LineHighlighter.swift I also noticed some potential bug. If anyone is happy working on this, you may need to pay extra attention to the correctness of the current highlight behaviour.
The tutorial resource can be downloaded from https://developer.apple.com/documentation/xcode/slothcreator_building_docc_documentation_in_xcode |
Confirm this is a bug on swift-docc-render instead of swift-docc. I've filed up a bug via swiftlang/swift-docc-render#662. |
A rough and incomplete implementation can be found at here #589 and swiftlang/swift-docc-render#664.
Some potiential UX design(Git-like code list) : |
@Kyle-Ye, you still working on this one, or want some help? I'd be interested in tinkering with it. |
Yeah, feed free to continue working on this. |
Spent a bit of time digging deeper, here's what I see. Some of these will be obvious to everyone, just documenting my first steps. Here's how things work now:
Here's what @Kyle-Ye has in progress:
It feels that @Kyle-Ye's pull requests are really close to completion. I would like to do some cleanup, if it makes sense:
@mportiz08, does this feel like a good direction to you? @Kyle-Ye, how does that sound? You did a lot of work on this, I want to make sure that I'm not blowing things up too much. If that feels right, I'll work on both swift-docc and the renderer side. |
I think the biggest next step here would be to start a thread in the Swift Forums to discuss:
It doesn't have to be much more than a couple of sentences that introduce the addition (highlighting deleted lines in tutorial code diffs) and present the two topics that you want to discuss in that thread (on page appearance and Render JSON specification updates). If you want, you can include suggestions/recommendations for what you feel that the UX should be and how this should be represented in the Render JSON spec. Otherwise you could phrase it more open ended as topics to be discussed without suggesting any particular answers yourself. If you send me a "personal message" in the Swift Forums we can iterate on the initial Forums post there.
There are two parts to these names; the properties in the source code and the properties in the RenderNode specification. For both we need to consider the backwards compatibility. For the source code I think we should add Unfortunately we can't do the same for the RenderNode specification. What we want to do about backwards compatibility in the RenderNode spec is something that we should discuss in the Forums.
To me, the additional information that would be most helpful here would be additional context about how the authored tutorials steps relate to the highlights are how the previous file is used and where it comes from. That said, it might be difficult to know how to describe this without experimenting with tutorials and steps with code files a bit and stepping through the code to see how how the line highlighter is used and where the information comes from.
I think the main place where this code highlights is documented today is the "Showing Differences Between Steps" section on the As far as I understand, deletions would be highlighted automatically without any additional effort or specific configuration from the documentation author. If so, my feeling is that the phrase "[...] and highlights the differences [...]" in the existing documentation is general enough that it covers both insertions and deletions from a documentation author's perspective.
|
@d-ronnqvist, thank you for looking into this! Agreed that the path forward is to source input on the forums. Thank you for pointing out the backwards compatibility piece. I'll write something up and tag you!
I have an experiment with a few tutorials in mind — I hope to get some first-hand experience there, and document what spots that I stumbled on. |
Feature Name
Highlight deleted code
Description
Highlight deleted lines (potentially using red background colour).
Motivation
Sometimes (especially when starting out from a template), you need to tell the reader to delete one of more lines of code. It seems like the renderer is not capable of highlighting deleted lines.
Here is an example;
peterfriese/MakeItSo#94 (comment)
Importance
No response
Alternatives Considered
No response
The text was updated successfully, but these errors were encountered: