-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add anchor links fixing #80 #260
Conversation
所以后续工作需要怎么做呢? |
后续工作是指同步吗?还是指 anchor 的问题?还是指别的什么?
我觉得我是不是该写份文件说明一下 Makefile 里干了什么…?
于 2019年3月2日 GMT+08:00 下午12:49:56, Tong Hui <[email protected]> 写到:
…所以后续工作需要怎么做呢?
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#260 (comment)
|
初步看了下还行,就是Makefile里面一堆sed看着很乱。 |
确实。希望能有更优雅的做法 |
@tonghuix |
我没太明白后续要怎么做?是说每篇文章都要 sed 一遍吗? |
(以下假定原书的 anchor 都在标题处) md 文件是要能直接适配 mkdocs 的,所以先在 mkdocs 生成的 html 里面 xxx 对应的文件,在源代码中找到 xxx 的位置,(没记错的话)会有一个 id 属性(如 id="2"),这个就是 mkdocs 自动设置的 anchor。 之后处理 pandoc 的 html,可以在 pandoc 生成的 html 中那个 anchor 的位置,和上面同样的办法找到它的 id 属性(为了方便叙述,假定是 id="aaaaaa",当然实际上这不可能)。(pandoc 的 html 在同一个文件里,所以相关链接得指向 #aaaaaa,这些链接的添加在 Makefile 的 sed 里做) 之后在 Makefile 的 sed 里加入 ……这种做法似乎很不优雅……希望有更好的办法。 |
确实不够优雅啊,我想有没有可能把你这个PR开到一个分支里。 我开了一个新分支 issue-80,这样可以直接向那个分支提交,改起来也方便。 |
#80 可以通过此法处理了(但是赶着上学来不及搞了)