Comments (3)
Hi @hugodessomme, this is possible by modifying the header.html
in the following way. You can see this in action in the example of the Cortana theme. Here's a snippet from Cortana's _header.html
:
<% catWrappers = Array.new %>
<% @categories.each do |cat| %>
<% catWrapperName = cat[0].split(nameScope).first %>
<% if not catWrappers.include?(catWrapperName) %>
<% catWrappers.push(catWrapperName) %>
<% end %>
<% end %>
<nav class="cortana-nav">
<ul>
<% if file_name.include?('index.html') %>
<li><a class="active" href="index.html">Home</a></li>
<% else %>
<li><a href="index.html">Home</a></li>
<% end %>
</ul>
<% catWrappers.each do |wrapper| %>
<h3><%= wrapper %></h3>
<ul>
<% @categories.each do |cat| %>
<% if cat[0].include?(wrapper) %>
<% catName = cat[0].split(nameScope).last %>
<% if catName == title.split(nameScope).last %>
<li><a class="active" href="<%= cat[1] %>"><%= catName %></a></li>
<% else %>
<li><a href="<%= cat[1] %>"><%= catName %></a></li>
<% end %>
<% end %>
<% end %>
</ul>
<% end %>
</nav>
In your hologram_config.yml
file, you'd need to add:
name_scope: ' - '
The string -
is used to separate the parent and child components in the category
property. Finally, in your documentation, you'd need to use it as:
/*doc
---
title: Small text
name: typography-small-text
category: Scaffolding - Typography
---
*/
...
/*doc
---
title: Strong text
name: typography-strong-text
category: Scaffolding - Typography
---
*/
As you can see, each component needs to have a parent (in the above example, Scaffolding
).
You can also give the Cortana theme a try, which support nested categories out of the box.
from hologram.
I will give it a try! Thank you :)
from hologram.
Closing this, you can do what you're looking for with more ruby code in the header.html or as @rishabhsrao using the Cortana theme (which is the same method but packaged up for you)
from hologram.
Related Issues (20)
- `get_binding` error HOT 8
- Markdown not being parsed HOT 2
- How to doc colors HOT 3
- Link external files into HTML-example area? HOT 1
- Multiple styleguides for different sections? HOT 2
- Create new categories with .md files HOT 2
- How would you support multiple languages?
- Ignore subdirectories or specific file
- Can we access markdown variables inside a template? HOT 1
- `ignore_paths` causing error
- SCSS variables and mixins seem to be ignored HOT 1
- Annoying <p class="styleguide"> generated listing CSS styles commented HOT 1
- Seperate JSON file output
- Possible issue with latest rouge update HOT 1
- Primary menu is not useful in its current state
- Provide a means to set order to nav and section items
- haml rendering without code block output
- Still maintained? HOT 4
- Loop in the Markdown HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hologram.