使用markdown而不更改模板的DOCFX格式表

Ben*_*dEg 4 markdown docfx

是否可以使用下的markdown更改表的布局docfx?

例如,由于列之间的间隔,下表的可读性不是很好。事件没有交替的行颜色:

| Property | Description |
|---|---|
| URL | `/api/<version>/auth/login` |
| Method | `post` |
| Success | Http status *200* |
| Failure | Http-status *400/500* |
| Content/Media-Type | `application/json` |
| Authorization | *no* |
| Roles | - |
Run Code Online (Sandbox Code Playgroud)

那就是它的样子doxfx:

MD表

某种预期的行为:

预期

Mat*_*hin 5

我们将扩展默认模板:

创建一个文件: (Project Folder)\template\styles\main.js

默认的DocFX模板使用Bootstrap和JQuery,因此在main.js中放入以下内容:

$(document).ready(function ()
{
   $("table").addClass("table table-bordered table-striped table-condensed");
})
Run Code Online (Sandbox Code Playgroud)

这使得降价表与Api文档中的相同。要使用Bootstrap表样式,请访问http://www.w3schools.com/bootstrap/bootstrap_tables.asp

现在,我们将此模板添加到docfx.json中:
在docfx.json中,替换"template": ["default"]为"template": ["default", "template"]。

  • 此问题已通过[#957](https://github.com/dotnet/docfx/pull/957)修复,当前版本的docfx(2.15.3.0)不会发生。因此,不再需要上述解决方法。 (2认同)