Markdown 如何在不添加CSS的情况下标记为呈现表?

Markdown 如何在不添加CSS的情况下标记为呈现表?,markdown,github-flavored-markdown,javascript-marked,Markdown,Github Flavored Markdown,Javascript Marked,我使用的是支持github风格降价的。这包括: 但是,输出有一堆不必要的内联样式: <table> <thead> <tr> <th>API</th> <th style="text-align:center">Documented CSP Policy</th> </tr> </thead> <tbody> <tr> <td>Google Fonts&

我使用的是支持github风格降价的。这包括:

但是,输出有一堆不必要的内联样式:

<table>
<thead>
<tr>
<th>API</th>
<th style="text-align:center">Documented CSP Policy</th>
</tr>
</thead>
<tbody>
<tr>
<td>Google Fonts</td>
<td style="text-align:center">No documented policy</td>
</tr>
<tr>
<td>Mixpanel</td>
<td style="text-align:center">No documented policy</td>
</tr>
(etc etc)

美国石油学会
记录CSP政策
谷歌字体
没有成文的政策
混音板
没有成文的政策
(等)

如何标记为只渲染HTML而不添加CSS?

确定找到了答案:截取
渲染器。tablecell
并设置
标志。将
对齐为
null

var marked = require('marked');
var renderer = new marked.Renderer();
var realTableCellRenderer = renderer.tablecell
renderer.tablecell = function(content, flags){
    flags.align = null;
    return realTableCellRenderer(content, flags)
}

var markdown = `
| API        | Documented CSP Policy           |
| ------------- |:-------------:|
|Google Fonts|No documented policy|
|Mixpanel|No documented policy|
|Ractive.js|[Documented policy](http://docs.ractivejs.org/edge/csp)|
|Stripe|[Documented policy](https://support.stripe.com/questions/what-about-pci-dss-3-1)|
|Twitter oembed API|No documented policy, but [some CSP notes](https://dev.twitter.com/web/overview/widgets-webpage-properties#csp)|
|Typekit|[Documented policy](http://help.typekit.com/customer/portal/articles/1265956-content-security-policy-and-typekit)|
|Stormpath|No documented policy|

`

console.log(marked(markdown, { renderer: renderer }));
返回干净的输出:

<table>
<thead>
<tr>
<th>API</th>
<th>Documented CSP Policy</th>
</tr>
</thead>
<tbody>
<tr>
<td>Google Fonts</td>
<td>No documented policy</td>
</tr>
<tr>
<td>Mixpanel</td>
<td>No documented policy</td>
</tr>
<tr>
<td>Ractive.js</td>
<td><a href="http://docs.ractivejs.org/edge/csp">Documented policy</a></td>
</tr>
<tr>

美国石油学会
记录CSP政策
谷歌字体
没有成文的政策
混音板
没有成文的政策
practive.js
<table>
<thead>
<tr>
<th>API</th>
<th>Documented CSP Policy</th>
</tr>
</thead>
<tbody>
<tr>
<td>Google Fonts</td>
<td>No documented policy</td>
</tr>
<tr>
<td>Mixpanel</td>
<td>No documented policy</td>
</tr>
<tr>
<td>Ractive.js</td>
<td><a href="http://docs.ractivejs.org/edge/csp">Documented policy</a></td>
</tr>
<tr>