Skip to content

Add ability to document maps in a DRY way #389

Open
@MattDiMu

Description

@MattDiMu

Sassdoc is great. I don't like, however, the way maps are documented, because I need to duplicate both - the name of the property as well as its value.

/// defines the colors used in this project
/// @type Map
/// @prop {color} primary [red] - used for navigation and other links
/// @prop {color} secondary [blue] - used for backgrounds
$colors: (
  primary: red,
  secondary: blue
);

I've read the discussion #25 about the original implementation, there were valid arguments to implement it the way it currently is and this implementation should definitely Stay. It would be great, however, if it could be enhanced with some sort of inline documentation like

/// defines the colors used in this project
/// @type map
$colors: (
  primary: red, /// used for navigation and other links
  secondary: blue /// used for backgrounds
);

Cons:

  • Different way of annotating
  • I've got no idea how difficult it would be to implement it

Pro:

  • more maintainable and less error-prone (it already happened to me multiple times, that i forgot to update the annotation after changing the default value of the map, especially if it's a large map and i have to scroll up to reach the annotation)
  • less to write
  • code is much more readable, especially (!!!) on large maps (e.g. configurations)

Personally I see SASSDOC not only as generator for a fancy documentation, but also as documentation guideline, defining the documentation syntax, which makes working in a team much easier. If I need to look after a variable/mixin/function, I often use the editor-shortcut to go to the desired file instead of opening sassdoc in my browser, as it's faster and I'm sure, that I'm not the only one. So readability, making it easy to find the corresponding annotation to a variable/property, is important to me.

PS Some sort of (optional) "inline" documentation might be useful for variables as well, as it feels "clearer" to me. Something like

$color: #FFAAFF; //< {color} description
$font-size: 10px; //< {number} description

What do you think, any opinions?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions