如何自定义Docfx文档(主题或模板)? [英] How can I customize Docfx documentation (themes or templates)?

查看:314
本文介绍了如何自定义Docfx文档(主题或模板)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用Docfx并设置了一些基本的概念性文档.现在,我想对主题进行一些调整(公司徽标,也许一些字体更改等).

I just started using Docfx and set up some basic conceptual documentation. Now I want to make some adjustments to the theme (company logo, perhaps some font changes, etc.) Minor stuff.

官方文档仅给出了如何创建的高级描述一个新的模板.我以前从未使用过模板语言,因此,如果可能的话,我现在暂时避免使用这种语言.

The official documentation only gives a high-level description of how to create a new template. I've never used a templating language before, so I'd like to avoid that for now if possible.

我的问题是:我如何才能对默认主题进行一些小的调整,例如对CSS进行一些更改,或者添加外部资源(如字体真棒)?

My question is: how can I make small adjustments to the default theme, like some CSS changes and perhaps adding external resources (like font awesome)?

我是否必须创建整个模板(或模板的一部分),还是可以以某种方式包含CSS文件?文档中提到了theme选项,但到目前为止,我还没有找到可以学习的示例或现有主题.

Do I have to create an entire template (or a part of it) or can I include a CSS file somehow? The documentation mentions a theme option but so far I've found no examples or existing themes to learn from.

仅链接到使用自定义主题或模板的项目将非常有帮助. docfx存储库具有docfx.website.themes文件夹,并且默认模板也位于其中我相信,但是我真的无法弄清楚我自己必须提供哪些文件.

A mere link to a project that uses a custom theme or template would already be very helpful. The docfx repo has a docfx.website.themes folder and the default template is also in there I believe, but I couldn't really figure out which files I would have to provide to roll my own.

推荐答案

  1. 导出模板:
    • 运行docfx template export default,然后您会在_exported_templates\default
    • 中看到默认模板
  1. Export template:
    • Run docfx template export default, then you'll see default template in _exported_templates\default
  • 添加外部资源:修改styles\head.tmpl.partial
  • 更改CSS:修改styles\docfx.cssstyles\main.css
  • Adding external resource: modify styles\head.tmpl.partial
  • CSS change: modify styles\docfx.css or styles\main.css
  • 运行docfx -t _exported_templates\default,它将使用您自定义的模板!
  • Run docfx -t _exported_templates\default, which will use your customized template!

注意:发布新版本时,DocFX可能会更新其嵌入式模板.因此,如果您覆盖或依赖自定义模板中的模板,请确保重新导出该模板.

NOTE: It is possible that DocFX updates its embedded templates when releasing new version. So please make sure to re-export the template if you overwrite or dependent on that template in your custom template.

这篇关于如何自定义Docfx文档(主题或模板)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆