FruitJS icon indicating copy to clipboard operation
FruitJS copied to clipboard

Menu levels incorrect if pages[] has only one input file

Open aleemb opened this issue 11 years ago • 4 comments

I have a single markdown file as input and was expecting all the headings in the generated html menu to be at the same level. However, all headings following the first one are nested at level 2 in the menu.

#one

hello

#two

world!

results in

TITLE
  HELLO
     WORLD

Would be great to see support for single pages as well. I am using this for generating HTML from my readme.md and while there are simpler tools for that the output generated by FruitJS is so much cleaner with some good configuration options and extensibility if I ever grow past a single readme.md which I eventually will.

aleemb avatar Jan 15 '14 21:01 aleemb

I'll look at the best way to do that. Right now I use the first header as the top level item because I assume everything will be a sub-menu under that. Having them be at the same level probably makes more sense.

And as far as single page, what exactly are you looking for there? If you're looking to compile several files to a single page, you can do it using the "singlePage" flag in the manifest. Is that what you mean?

LoveAndCoding avatar Feb 10 '14 19:02 LoveAndCoding

I meant with a single markdown file only--but that idea was short lived as now I have multiple MD files in any case.

Yeah having them at the same level would be cleaner.

aleemb avatar Feb 11 '14 07:02 aleemb

Hey @aleemb, The new code isn't quite ready to use yet, but right now it goes solely based on the value of the header. So any h1 tags would be top level menu items, and h2 tags would be the next level, etc. Right now, if they are different markdown files, the first header to be included in the nav is always a top level menu item, and I was wondering if that was something you'd prefer to not have. Is there a time when you want the first menu item on a different page to be a submenu item for a header on the previous page? Thanks

LoveAndCoding avatar Aug 30 '14 01:08 LoveAndCoding

Is there a time when you want the first menu item on a different page to be a submenu item for a header on the previous page?

Yes, absolutely. For example a book can have chapters and each chapter could be broken up into multiple files rather than one really long file.

If a file contains two level-1 headings:

# Carnivores
# Herbivores

and the fruitjs.config.json file named this "Animals" then the generated menu should ideally be:

Animals
  Carnivores
  Herbivores

but instead it is:

Animals
  Carnivores
    Herbivores

This seems semantically incorrect since my markdown defined both headings as level-1 but the generated menu represented them as level-1 and level-2 headings respectively.

It would allow users to control the menu through headings levels. Generating a menu based on the heading hierarchies seems more intuitive and straightforward.

aleemb avatar Sep 02 '14 20:09 aleemb