From ecc55aaed233d5ab24ccab55f2e12f530c7f70bb Mon Sep 17 00:00:00 2001 From: Mattt Date: Fri, 31 Jul 2020 06:05:39 -0700 Subject: [PATCH 1/2] Add zero width space to escape emoji shortcodes --- Sources/swift-doc/Supporting Types/Page.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/swift-doc/Supporting Types/Page.swift b/Sources/swift-doc/Supporting Types/Page.swift index 7e4886c2..29ba9da3 100644 --- a/Sources/swift-doc/Supporting Types/Page.swift +++ b/Sources/swift-doc/Supporting Types/Page.swift @@ -24,7 +24,13 @@ extension Page { let data: Data? switch format { case .commonmark: - data = document.render(format: .commonmark).data(using: .utf8) + var text = document.render(format: .commonmark) + // Insert U+200B ZERO WIDTH SPACE + // to prevent colon sequences from being interpreted as + // emoji shortcodes (without wrapping with code element). + // See: https://docs.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax#using-emoji + text = text.replacingOccurrences(of: ":", with: ":\u{200B}") + data = text.data(using: .utf8) case .html: data = layout(self).description.data(using: .utf8) } From e883acba620e25cabf2ba0651639405d007160fa Mon Sep 17 00:00:00 2001 From: Mattt Date: Fri, 31 Jul 2020 06:17:26 -0700 Subject: [PATCH 2/2] Add changelog entries for #149 --- Changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changelog.md b/Changelog.md index 647227cf..fd409899 100644 --- a/Changelog.md +++ b/Changelog.md @@ -33,6 +33,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 #130 by @mattt. - Fixed file and directory unexpected permissions. #146 by @niw. +- Fixed rendering of colon sequences in function signatures + as emoji shortcodes (e.g. `:on:` → 🔛). + #149 by @mattt. ## [1.0.0-beta.3] - 2020-05-19