Skip to content
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

Auto-linking HTML-escaped operators #805

Closed
reitzig opened this issue May 10, 2017 · 9 comments
Closed

Auto-linking HTML-escaped operators #805

reitzig opened this issue May 10, 2017 · 9 comments

Comments

@reitzig
Copy link

reitzig commented May 10, 2017

Say I have code like this:

indirect enum Expr {
	case .number(Int)

	/**
		- Seealso: `Expr.&(...)`
	*/
	case .and(Expr, Expr)

	static func &(lhs: Expr, rhs: Expr) -> Expr {
		return .and(lhs, rhs)
	}
}

How do I refer to & in a way that auto-links?

Neither & (locally), Expr.&, Expr.&(...), nor Expr.&(lhs:rhs:) work.

@johnfairh
Copy link
Collaborator

johnfairh commented May 10, 2017

The most reliable way is, in this case, +(_:_:) or Expr.+(_:_:) -- the part after the period is the name that jazzy thinks the symbol has, as show in its doc page.

I also found that Expr.+(...) worked for me, the ... works as a sort of wildcard.

@reitzig
Copy link
Author

reitzig commented May 11, 2017

Hm... did you also try it in the callout? I'm on v0.8.1, if that's relevant.

I'm looking at the generated doc right now, and there's no link. (Things are called by different names, but that shouldn't be a problem? My operator is &.)

@johnfairh johnfairh added the bug label May 11, 2017
@johnfairh
Copy link
Collaborator

You're right, '&' doesn't work -- it's coming in as & to a routine that is not expecting that :/

screen shot 2017-05-11 at 14 04 02

@reitzig reitzig changed the title Auto-linking operators Auto-linking HTML-escaped operators May 11, 2017
@reitzig
Copy link
Author

reitzig commented May 11, 2017

Ahh, oh my! Editing the original post so it's immediately clear what the issue is.

Given that Swift allows Unicode identifiers, apparently some hardening has to happen.

@SDGGiesbrecht
Copy link
Contributor

Does the flag --use-safe-filenames handle the ampersand? When it is turned on, Jazzy sanitizes any characters that are bad to use in URLs (the definition of which characters are “bad” is left up to Ruby).

@SDGGiesbrecht
Copy link
Contributor

P.S. At least with --use-safe-filenames on, I can reliably link with things like ×(_:_:) and √(_:), so this is related to HTML, not Unicode.

@johnfairh
Copy link
Collaborator

That flag doesn't help here: the problem happens before generating the link, code is matching html-escaped text from markdown output against real declaration names. Yes general unicode is fine, it's just the html escapes & < > that cause problems AFAICT.

@SDGGiesbrecht
Copy link
Contributor

I just verified it. @johnfairh, you are right on all counts. I stand corrected.

@johnfairh
Copy link
Collaborator

Fixed in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants