Closed xiaohuoni closed 5 years ago
使用 https://github.com/bibig/node-shorthash 生成的 hash,可以考虑下
sh.unique('abcdefg')
使用 https://github.com/bibig/node-shorthash 生成的 hash,可以考虑下
sh.unique('abcdefg')
这是什么意思呢?
使用 https://github.com/bibig/node-shorthash 生成的 hash,可以考虑下
sh.unique('abcdefg')
这是什么意思呢?
大概是这样子:
const text = $('h1').text(); const hash = sh.unique(text); $('h1').attr('id', hash);
你是说我需要这样定义路由,还是说你将要这么修改?
你是说我需要这样定义路由,还是说你将要这么修改?
插件是按照这套规则生成的 id
我也按这个规则可以实现导航了。但是因为是随机数,链接里面没体现内容,不是很完美
我最早选择 hash 的原因有 2 点:
不过这样似乎的确给一些目录的构造造成了困难,比如
https://github.com/mxstbr/markdown-test-file/blob/master/TEST.md
所以这一点可能还得调整
锚点和id是一个随机值,如果有需求上的冲突希望多一个配置,支持直接使用文本
和我生成的导航对应不上