问题描述
在我的Githubs repos 文档 中,我想表示一个目录树结构,如下所示:
有没有办法通过Github风格降价来做到这一点,除了用ascii艺术创建它?
因此,基本上像,但我想知道是否有一个github特定的解决方案。
不直接,不。你必须手工创建并将其放入自己。假设你在本地使用一个* nix框并使用utf,那么将生成它很好(我相信这就是你在上面使用的例子)。
假设你的意思是 readme.md
作为文档目标,那么我认为自动化它的唯一方法就是运行 tree
的git pre-commit钩子并将其嵌入到自述文件中。如果输出发生变化,您需要进行比较以确保只更新自述文件。
Otoh如果您通过github页面维护单独的文档,那么您可以 ,切换到在本地使用jekyll(或其他生成器)并自行推送静态页面。然后,您可以实现所需的更改,作为插件/ shell脚本* /手动更改(如果它们变化不大),或使用与上述相同的方法。
*如果您将其集成到提交挂钩中,则可以避免添加任何额外步骤来更改页面。
In my Githubs repos documentation I want to represent a directory tree structure like this:
Is there a way to do that with Github flavoured markdown, besides just creating it with ascii art?
So basically like this question, but I'm wondering if there is a github specific solution.
Not directly, no. You'd have to hand create it and put it in yourself. Assuming you are using a *nix box locally and are using utf, then tree will generate it nicely (I believe that is what generated the example you used above).
Assuming you mean the readme.md
as the documentation target, then I think the only way you could automate it would be a git pre-commit hook that ran tree
and embedded it into your readme file. You'd want to do a diff to make sure you only updated the readme if the output changed.
Otoh if you are maintaining seperate docs via github pages, then what you could do, is switch to using jekyll (or another generator) locally and pushing the static pages yourself. Then you could potentially implement the changes you want either as a plugin / shell script* / manual changes (if they won't vary much), or use the same method as above.
*If you integrate it into a commit hook, you can avoid adding any extra steps to changing your pages.
这篇关于有没有办法在Github README.md中表示目录树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!