docsifyjs / docsifyjs/docsify

Allow hooks to work for Sidenav

未关闭
#1,329 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
JavaScript
星标
31.5k
派生
5.8k
平均合并
9 天 8 小时
30 天内合并 PR
2

描述

## Feature request

Allow hooks to work for Sidenav (and perhaps Navbar)

#### What problem does this feature solve?

I have a need where sidebar data is being generated (outside of my control) in a format different from that specified for './_sidebar.md'. With hooks enabled I can modify the sidebar information to the format Docsify wants.

#### What does the proposed API look like?

No changes to the API

#### How should this be implemented in your opinion?

Add `beforeEach` and `AfterEach` hooks to `proto._renderSidebar` when invoking `proto.renderTo` in the same pattern as `proto._renderMain` in 'src/render/index.js'. Though I am not sure since I cannot claim to fully understand the code.

#### Are you willing to work on this yourself?

Only if a maintainer will discuss proposed changes in code and verify my changes! Last thing I want to do is upload a poor PR that breaks things!!!

贡献指南

打开贡献指南

调研方向

从 src/render/index.js 开始比较 proto._renderSidebar 和 proto._renderMain,特别是确认 proto.renderTo 如何调用现有的 hooks。与 maintainer 确认 Sidenav,以及可能还有 Navbar 的预期行为;完成的标准是,在不破坏现有 render 流程的情况下,所请求的 hooks 会在渲染 sidebar 时运行。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
frontend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。