-
Notifications
You must be signed in to change notification settings - Fork 200
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
Allow greater level of category nesting #92
Comments
I think we support this nesting already, though perhaps it's not clear in our documentation. With name and parent you can also nest even more if desired. |
@jdcantrell as far as I can tell what actually happens is that children inherit the category of their parent. No way to nest categories, unless I'm missing something. current setup:
this results in all of the buttons being inside of the "elements" category. I would like to see them in a "buttons" category which is nested inside of the "elements" category. |
@VinSpee there is currently no way to nest categories at all. However, you could create a top level comment block with the name I did this in several places in the Trulia styleguide where the top level comment has no code examples. It's just some text describing the component and a place to setup this type of nesting. Does that make sense? |
@aflanagan this works - thanks! |
actually I'm going to leave this open. While that is a solution @aflanagan, I still think it'd be valuable to be able to nest. For example, I like to follow a sort of combination of SMACSS and Atomic Design. I'd love to be able to nest like so:
Get what I mean? |
Hmmm...i'm not sure I do. When I look at this structure it looks very similar to how we laid out the Trulia styleguide using the method I described. What is missing that would prevent you from doing this right now? |
Here's what my desire as applied to the trulia example would look like: The goal is this: I want to have several categories of documented code:
Elements are just that, elements. Components are groups of elements. Modules are groups of components. Pages are groups of modules. There are many different (and unrelated) types of "elements". Buttons (a parent) and inputs (a parent) are the clearest examples. The reason Hologram in it's current state doesn't quite cut it for this is because they will always be displayed together (on the same page). Ideally, buttons would we a sub-category of elements, and therefore displayed on their own page. For example, I currently have this setup:
now, forms has several children:
etc. I also have buttons, which are a type of element.
which also have several children.
etc. Currently, these all show up under the "elements" page. I'd like the elements page to show the content for "name: button" and "name: forms", as well as links to pages that show all of their children. Make sense? From what I gather, there is no way to do this in Hologram at the time. |
I'd agree that this isn't available out of the box with Hologram and given your example, I also support having something like this. In the meantime, you may be able to hack around to accomplish something very close. If you give a 'child' element a category different from its parent, it will render on a separate page. To generate your index, you'd have to create categories with 'keys' in them, and in the _header do some custom Ruby. So, a category like Buttons, and then the child could be 'Buttons > Base'. An example theme that does something along these lines is available at https://github.com/Yago31/Cortana. It's obviously a fair bit of work, and I'm not completely sure you can achieve what you're looking for, but I think you can get very close. |
@mikezx6r thank you for the resource and confirmation. Cortana does give me enough to hack around this - thanks so much for that link! I think it would be great to implement something like this at the base level as well. Thanks again! |
OooOoo, I like Cortana's category syntax. With that, we can have the parent implied. Its great for documentation since we don't have to jump around files to figure out whats a parent of what and its more informative when you just want to browse around the source code. |
So cool that people are building themes for hologram. :) Tonight I worked on a modification to hologram that would allow a component to be listed under multiple Categories. We are using the categories more like filters than a classification system. For example we have base components, form inputs, components that require JavaScript, etc... For us this is helpful because we want to have an "all components" page as well as having the same component listed as requiring JS, for example. @VinSpee - I think you could have achieved what you are looking for by modifying the navigational markup in _header, but it's great that Cortana gave you what you want. It looks like you wanted level one and two html linked together and level 3 html outputted separately, no? |
Oh wait, I see what you mean, yeah, hologram doesn't do that. |
@ckundo, @stubbornella and I would also benefit from nested categories. We want to use a visual diff tool -- like phantomcss or csscritic -- for regression testing. Both tools recommend components on individual pages. Having nested categories would make this possible. Would you be open to pull requests? |
Definitely open to PRs for this, but for your specific task I recently added plugin support to help handle the csscritic case (we're attempting to use it at Trulia as well.) I made a plugin that will either take html from a test block or from an html_example block and generate a smaller html fragment that can be used for visual testing. You can see the plugin class and the corresponding doc block to use it here: https://gist.github.com/jdcantrell/b0ad9a6bcbfc2551713f If this sounds like it might work for you I'm happy to discuss it more via chat/email or some other means (-: |
@jdcantrell that's great, thanks for the link! We'll try it out and ping you if we run into blockers. |
This might be helpful: #121. I think my todo list for the next few weeks just became document hologram better. But please let me know if you run in to anything. |
Closing this for now, it's not something I want to add in, but would be open for more discussion and code later. |
I'd love to be able to nest categories further. ex:
that way I can arrange by type, in this case:
The text was updated successfully, but these errors were encountered: