mpetrovich / stylemark

Generate interactive style guides from Markdown.
MIT License
218 stars 35 forks source link

Allow ordering based on the css or markdown file itself #38

Closed nickimola closed 6 years ago

nickimola commented 6 years ago

Hi,

It would be good to have an option to use the css (or markdown) order for ordering, rather than having to add + and - in the config file. This could be especially useful for larger configuration, as the + and - could get quite messy quite quickly.

Thanks

mpetrovich commented 6 years ago

@nickimola thanks for the suggestion! In your mind, how should it work?

Would you specify an actual position number in the front matter?

---
name: Some Component
order: 3
---

Or a "priority" value where lower numbers = near the top of the list, higher numbers = near the bottom of the list?

---
name: Some Component
priority: 10
---

Or some other way?

carvallegro commented 6 years ago

Or maybe just dropping the + and - and have a proper hierarchy in the configuration? And all of the unspecified categories and components are sorted alphabetically after the specifed order?

Example:

order:
- General:
  - Introduction
  - Installation
- Components:
  - Button
  - ListItem
  - List
nickimola commented 6 years ago

Hi @mpetrovich I do like the suggestions provided by @carvallegro, it thinks it would make it easier to create the order, and possibly it can also solve another feature request which is to order the sub categories, so you might be able to catch two birds with one stone.

My initial thought was to just use the order of the CSS file itself, but it think the one suggested here is more clean than mine and allows for more control.

mpetrovich commented 6 years ago

We don't actually need to drop + and - to achieve what @carvallegro suggests—the +/- are optional, and you can write out the order without them. The only difference between that proposal and what we support today is the ability to specify the order of elements within each category.

Since there seems to be consensus to keep ordering within the config, I'm going to close this in favor of https://github.com/nextbigsoundinc/stylemark/issues/10. Please comment/reopen if you disagree.