Skip Navigation
Type MethodMethod

pagePathKey(_:)

Normalises a documentation path in the same way generated page paths are derived.

static func pagePathKey(_ path: String) -> String

Parameters

path

A documentation path, such as a render node identifier path.

Return Value

The normalised path.

Discussion

Leading, trailing and repeated slashes are removed and every component is lowercased, so /documentation/Module/Type/ becomes documentation/module/type. Like the file-safe paths of swift-docc, a component starting with a period gets a leading apostrophe, so /documentation/Module/Type/...(_:_:) becomes documentation/module/type/'...(_:_:) rather than naming a hidden directory; paths that already have the apostrophe stay as they are.