docsifyjs / docsifyjs/docsify

Proposal: auto generate sidebar

Abierto
#1,290 9 comentarios 17 reacciones 1 asignado Asignado a @sy-records Ver en GitHub
enhancement pinned
Lenguaje dominante
JavaScript
Estrellas
31.5k
Forks
5.8k
Merge medio
9 d 8 h
PR fusionados (30 d)
2

Descripción

# Auto-generate sidebar

## Summary

Auto-generate and update the sidebar i.e `_sidebar.md` by looking into the folders/files

## Motivation
If you have a big project or a project having many markdown files. It is kind of extra work look for each file and writes the path and the file name and the text to display it.
Maximum projects I have seen take each `.md` file as a single page and `.md` files under a folder inside the docs directory is a sub-page. So if we go with usual lookups through each file/folder. This is quite easy to achieve.

## Detailed Design

No changes are required in the core. Only needs changes in cli. New command probably

If we have directories like this

```
|-
|- README.md
|- index.html
|- _sidebar.md
|- a.md
|- guide
|- guide-a.md
|- b.md
```

The sidebar command should generate the following
```md
- [a](./a.md)
- guide
- [a](./guide/guide-a.md)
- [b](./b.md)
```

We need to traverse through the directory and create an object or tree and then just print the tree as a list in the markdown.

## Documentation
Update the docs in the main docs site as a separate page and create docs for the command in the cli and do a remote rendering of the page in the main docs

## Drawbacks

Few

- It won't know whether markdown file should be in the heading or in subheading if it goes out of our prediction.
- cant do the operation for the `.html` files.

## Backwards Compatibility Analysis

Not required as no changes in the core is being done.

## Alternatives

Do the manual entry in the `_sidebar.md`

## Open Questions

- Should we wait for or put this in `v5` ?
- Any volunteers for taking this ?

## Help Needed

None.

## Frequently Asked Questions

None

## Related Discussions

Couldnt find any.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.