首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >wintersmith:可视化内容树

wintersmith:可视化内容树
EN

Stack Overflow用户
提问于 2014-01-18 17:17:51
回答 2查看 606关注 0票数 3

wintersmith api文档谈到:

getPluginColor() Return vanity color used to identify the plugin when printing the content tree choices are: bold, italic, underline, inverse, yellow, cyan, white, magenta, green, red, grey, blue, rainbow, zebra or none.

我该怎么做print[ing] the content tree?我想假设我可以通过cli做到这一点。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-12-11 16:36:00

在没有构建的情况下,无法从CLI中选择这样做。但是这个小脚本就能做到:

代码语言:javascript
复制
var wintersmith = require('wintersmith')
var env = wintersmith('/path/to/your/projects/config.json')
env.load(function(error, result) {
  console.log(wintersmith.ContentTree.inspect(result.contents))
})
票数 2
EN

Stack Overflow用户

发布于 2014-02-08 07:25:53

每次使用ContentTree构建wintersmith时都会打印wintersmith build,因此您的假设是正确的。查找rendering tree:及其后面的内容。/content下的所有文件都将显示并显示源文件和结果输出文件,包括它们在目录结构中的位置。

示例输出:

代码语言:javascript
复制
rendering tree:
    articles/
      another-test/
        index.md (url: /articles/another-test/)
      bamboo-cutter/
        index.md (url: /articles/bamboo-cutter/)
        taketori_monogatari.jpg (url: /articles/bamboo-cutter/taketori_monogatari.jpg)
      hello-world/
        index.md (url: /articles/hello-world/)
      markdown-syntax/
        index.md (url: /articles/markdown-syntax/)
      red-herring/
        banana.png (url: /articles/red-herring/banana.png)
        index.md (url: /articles/red-herring/)
      test.md (url: /articles/test.html)
    authors/
      baker.json (url: /authors/baker.html)
      the-wintersmith.json (url: /authors/the-wintersmith.html)
    css/
      main.css (url: /css/main.css)
    posts/
      test.md (url: /posts/test.html)
    .DS_Store (url: /.DS_Store)
    about.md (url: /about.html)
    archive.json (url: /archive.html)
    feed.json (url: /feed.xml)
    index.json (url: /)

如果您好奇,您可以在这里找到这样做的代码:https://github.com/jnordberg/wintersmith/blob/master/src/core/renderer.coffee#L36

关于getPluginColor(),这是一个在内容插件上公开的函数。您应该看到用cyan打印的源文件,它与下面的代码行相对应:https://github.com/jnordberg/wintersmith/blob/master/src/core/content.coffee#L60

其他内容插件可以返回一个不同的颜色,如果他们选择,这可以增强可视化打印通过CLI。

我希望这能帮上忙!

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21207294

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档