有没有办法在 Markdown 中创建用户定义的函数?
Is there a way to create a user defined function in Markdown?
使用 Jekyll 和 git 中心页面创建了一个博客。我需要缩进以对齐费用清单。我找到了方法,但我想将其插入到函数中。
示例:
- 承包商费用总和 - 6,800 美元
- 暖气和空气 - 5,100 美元
- 冰箱和炉灶 - 1,100 美元
- 五金店购买 - 5,000 美元
- 杂项 - 2,000 美元
我希望所有的金额都一致。
根据这个 SO question,我可以使用
创建一个 space。但是,我需要插入很多这样的东西才能得到我想要的。
另一个建议是Tab+Space
,但这在正文中间似乎不起作用。
来自同一个 post,我尝试使用 Alt+0+1+6+0
,这似乎有效。
预期结果如下所示。
- 承包商费用总和 -
TAB;
6,800 美元
- 供暖和空调 -
TAB;(5)
5,100 美元
作为对 SO question 的回答指出:
There's no way to do that in markdown's native features. However markdown allows inline HTML...
有几种方法可以做到这一点。您可以使用 <table>
元素,其中 HTML 如下所示:
<table>
<tr><td>Sum of Contractor expenses</td><td>,800</td></tr>
<tr><td>Heating and Air</td><td>,100</td></tr>
<tr><td>Fridge and Stove</td><td>,100</td></tr>
<tr><td>Hardware store purchases</td><td>,000</td></tr>
<tr><td>Miscellaneous</td><td>,000</td></tr>
</table>
或者,您可以使用 class 名称和 CSS,其中 HTML 如下所示:
<div>
<span class="description">Sum of Contractor expenses</span>
<span class="cost">,800</span>
</div>
<div>
<span class="description">Heating and Air</span>
<span class="cost">,100</span>
</div>
<div>
<span class="description">Fridge and Stove</span>
<span class="cost">,100</span>
</div>
<div>
<span class="description">Hardware store purchases</span>
<span class="cost">,000</span>
</div>
<div>
<span class="description">Miscellaneous</span>
<span class="cost">,000</span>
</div>
而且,CSS 看起来像这样:
.description { width: 100px }
.cost { width: 30px; text-align: right; }
注意 1:您需要调整宽度以使内容按您想要的方式对齐。
注意 2:您还可以将 class 名称和 CSS 应用于 <table>
中的 <td>
标签。
使用 Jekyll 和 git 中心页面创建了一个博客。我需要缩进以对齐费用清单。我找到了方法,但我想将其插入到函数中。
示例:
- 承包商费用总和 - 6,800 美元
- 暖气和空气 - 5,100 美元
- 冰箱和炉灶 - 1,100 美元
- 五金店购买 - 5,000 美元
- 杂项 - 2,000 美元
我希望所有的金额都一致。
根据这个 SO question,我可以使用
创建一个 space。但是,我需要插入很多这样的东西才能得到我想要的。
另一个建议是Tab+Space
,但这在正文中间似乎不起作用。
来自同一个 post,我尝试使用 Alt+0+1+6+0
,这似乎有效。
预期结果如下所示。
- 承包商费用总和 -
TAB;
6,800 美元 - 供暖和空调 -
TAB;(5)
5,100 美元
作为对 SO question 的回答指出:
There's no way to do that in markdown's native features. However markdown allows inline HTML...
有几种方法可以做到这一点。您可以使用 <table>
元素,其中 HTML 如下所示:
<table>
<tr><td>Sum of Contractor expenses</td><td>,800</td></tr>
<tr><td>Heating and Air</td><td>,100</td></tr>
<tr><td>Fridge and Stove</td><td>,100</td></tr>
<tr><td>Hardware store purchases</td><td>,000</td></tr>
<tr><td>Miscellaneous</td><td>,000</td></tr>
</table>
或者,您可以使用 class 名称和 CSS,其中 HTML 如下所示:
<div>
<span class="description">Sum of Contractor expenses</span>
<span class="cost">,800</span>
</div>
<div>
<span class="description">Heating and Air</span>
<span class="cost">,100</span>
</div>
<div>
<span class="description">Fridge and Stove</span>
<span class="cost">,100</span>
</div>
<div>
<span class="description">Hardware store purchases</span>
<span class="cost">,000</span>
</div>
<div>
<span class="description">Miscellaneous</span>
<span class="cost">,000</span>
</div>
而且,CSS 看起来像这样:
.description { width: 100px }
.cost { width: 30px; text-align: right; }
注意 1:您需要调整宽度以使内容按您想要的方式对齐。
注意 2:您还可以将 class 名称和 CSS 应用于 <table>
中的 <td>
标签。