Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Generated using swift-doc link missing http(s) #166

Closed
ctreffs opened this issue Aug 21, 2020 · 1 comment · Fixed by #167
Closed

Generated using swift-doc link missing http(s) #166

ctreffs opened this issue Aug 21, 2020 · 1 comment · Fixed by #167
Labels
bug Something isn't working
Milestone

Comments

@ctreffs
Copy link

ctreffs commented Aug 21, 2020

Just a minor issue, I've noticed the generated link-out to the swift-doc repository is missing a http(s): for all generated pages.
I'm talking about the end section of the generated pages where something like this is added.
Generated at 2020-08-21T06:​49:​18+0000 using swift-doc 1.0.0-beta.4.

The link is rendered as //github.com/SwiftDocOrg/swift-doc rather than https://github.com/SwiftDocOrg/swift-doc and therefore does not lead to a valid github.com page.

You can observe this behavior i.e. at https://github.com/fireblade-engine/ecs/wiki

This behavior holds true for swift-doc 1.0.0-beta.4 as of now.

Thanks for your great library 👍

@mattt
Copy link
Contributor

mattt commented Aug 21, 2020

@ctreffs Thanks so much for pointing this out. This one was somewhat difficult to track down.

As you can see in the code, the URL to swift-doc is correct:

fileprivate let href = "https://github.com/SwiftDocOrg/swift-doc"

This is included directly using string interpolation:

"Generated at \(timestamp) using [swift-doc](\(href)) \(SwiftDoc.configuration.version)."

In the rendered CommonMark, the link shows as https:​//. The expected UTF-8 sequence for these characters is:

68 74 74 70 73 3A 2F 2F

However, the actual output is:

68 74 74 70 73 3A E2 80 8B 2F 2F

The unexpected UTF-8 sequence E2 80 8B corresponds to the invisible Left-to-Right (LTR) control character.

Generating it locally with swift-doc 1.0.0-beta.3, the link is correct, without an LTR mark. Re-running with 1.0.0-beta.4, we do get the invisible character.

I believe this issue is related to #158, and that both are a consequence of #149 (aeed63c) — specifically, this line.

text = text.replacingOccurrences(of: ":", with: ":\u{200B}")

Looking at it now, it's obvious that this is way too heavy-handed a solution to escaping GitHub short codes. I have a draft PR reverting and fixing this behavior with #167.

That said, I'm not entirely sure what the connection is between zero-width space and LTR. It could very well be that this is due to another, unrelated change in beta 4. But I'll confirm before #167 is merged in.

@mattt mattt added the bug Something isn't working label Aug 21, 2020
@mattt mattt added this to the 1.0.0-beta.5 milestone Aug 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants