你如何使用降价制作字母列表?

时间:2012-11-13 18:49:38

标签: markdown

Markdown允许使用数字的有序列表。如何使用字母获取有序列表?即。

A. the letter A
B. the letter B
C. etc

而不是

1. the number 1
2. the number 2
3. etc.

6 个答案:

答案 0 :(得分:66)

标准Markdown似乎没有此功能。你可以:

  1. 使用CSS,将其放在降价文档的某处(注意,这将影响文档中的所有有序列表)

    <style type="text/css">
        ol { list-style-type: upper-alpha; }
    </style>
    
  2. 使用markdown的扩展版本。 Pandoc markdown具有fancy_lists扩展名,允许您使用字母和罗马数字标记列表。

    http://johnmacfarlane.net/pandoc/demo/example9/pandocs-markdown.html

答案 1 :(得分:19)

Markdown本身不能这样做,但由于你可以将HTML放入其中,这提供了一种非常简单的方法:

$id,$month,$year

某些平台上的某些派生可能只解释非常严格的HTML子集。例如,StackOverflow不支持<ol type="a"> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ol> 属性。但是Wikipedia's MediaWiki Markdown会这样做,GitHub Wiki Markdown也会这样做。

答案 2 :(得分:11)

至少对于最近版本的Pandoc(我使用的是版本1.13.1),看起来你可以使用一些fancy_list语法,而不必启用扩展,例如:

I.  One                                                                                                                                                                                        
    A.  two                                                                                                                                                                                    
        1. three                                                                                                                                                                               
        2. four                                                                                                                                                                                
            i.  five                                                                                                                                                                           
            ii.  six                                                                                                                                                                           
                - seven                                                                                                                                                                        
                    * eight                                                                                                                                                                    
II.  Nine

要将其编译为PDF,您可以运行:

pandoc input.md -o output.pdf

注意:要使其正常工作,您必须确保在任何字母或罗马数字之后添加额外的空格:而不是子弹和文本之间通常的一个空格,请使用两个。 (参见pandoc docs)

答案 3 :(得分:2)

迟到聚会,但这可能会帮助其他人寻找R Markdown解决方案。

在R Markdown中很简单。以下最小示例lists.rmd显示了不同的类型:

---
title: "Lists"
output: pdf_document
---

A list with bullet points:

- Something
- Something else

A numeric list:

1. Something
1. Something else

A list using small letters:

a) Something
a) Something else

A list using capital letters:

A) Something
A) Something else

这与以下内容有关:

enter image description here

答案 4 :(得分:1)

我要使用缩进格式:

<style type="text/css">
   /* Indent Formatting */
   /* Format: a-1-i-A-1-I */
   ol {list-style-type: lower-alpha;}
   ol ol { list-style-type: decimal;}
   ol ol ol { list-style-type: lower-roman;}
   ol ol ol ol { list-style-type: upper-alpha;}
   ol ol ol ol ol { list-style-type: decimal;}
   ol ol ol ol ol ol { list-style-type: upper-roman;}
   /* https://www.w3schools.com/cssref/pr_list-style-type.asp */
   /* https://stackoverflow.com/questions/11445453/css-set-li-indent */
   /* https://stackoverflow.com/questions/13366820/how-do-you-make-lettered-lists-using-markdown */
</style> 

底部链接到我的信息来源。第二行说明了格式。

答案 5 :(得分:0)

当我们希望将列表保存在md文件中时,通常可以使用一种解决方法。我将它们包装如下:

copy paste this below code in markup: 
           ```javascript
             1. Fruits
                 i. banana
                ii. apple
             2. Vegitables
                 i. Potato  
           ```

输出:

1. Fruits
    i. banana
   ii. apple
2. Vegitables
    i. Potato  
相关问题