swift-doc icon indicating copy to clipboard operation
swift-doc copied to clipboard

Group enum cases based on `MARK` comments

Open sindresorhus opened this issue 4 years ago • 4 comments

For https://github.com/sindresorhus/KeyboardShortcuts/blob/49b017b2450ac37353934d94d6c64957b62c45b4/Sources/KeyboardShortcuts/Key.swift#L8-L34, I get the following: https://sindresorhus.com/playground/KeyboardShortcuts_Key/

With Jazzy, I get the enum cases grouped too: https://sindresorhus.com/KeyboardShortcuts/Classes/KeyboardShortcuts/Key.html#/Letters

sindresorhus avatar May 12 '20 08:05 sindresorhus

@sindresorhus Curious to know, do you have any thoughts about how MARK headings should relate to declaration type groupings? Should we treat them as peers / alternates or should we see the current "by type" grouping just as the default sections for when MARK headings aren't provided?

mattt avatar May 12 '20 19:05 mattt

My preference would be for them to be sub-headings under the Enumeration Cases section. Jazzy makes them top-level sections, which feels wrong to me.

sindresorhus avatar May 13 '20 15:05 sindresorhus

@sindresorhus What if a section contains different kinds of symbols? For example:

enum E {

// MARK: Example

case c
func f() {}
}

Would they repeat for each kind of symbol, like this?

  • Cases
    • "Example"
      • c
  • Methods
    • "Example"
      • f()

mattt avatar May 13 '20 16:05 mattt

Not sure, to be honest. I wouldn't use MARK like that.

sindresorhus avatar May 16 '20 10:05 sindresorhus