2016-07-15 56 views
0

我正在嘗試製作錨鏈接,但只能看到使用標題進行錨鏈接的引用。有沒有辦法使用pandoc標記製作非標題錨鏈接

# Header 
Go and see the [Header](#header) 

但是,我想鏈接列表中的特定單詞。有沒有辦法讓一個單詞成爲主播?

#. This phrase should be the anchor 
Go and see number ([I.11](#this-phrase-should-be-the-anchor) 

更新

仍與原來的問題沒有運氣。我想我可能不得不用頭來解決重組我的文檔,這並不令我感到興奮。我可能會有一些文檔有深刻的章節,html不能超越h6,但是現在我會認爲那些文檔很少,很少。

我發現的唯一解決方案是一個CSS,它可以修改頭文件以包含字母數字計算,這將使格式化比使用列表更好,因爲我必須爲代碼做一些時髦的破解。這裏是什麼,可能潛在的樣子

body { 
 
     counter-reset: section; 
 
    } 
 

 
    h1 { 
 
     counter-reset: subsection; 
 
    } 
 

 
    h2 { 
 
     counter-reset: subsubsection; 
 
    } 
 

 
    h1:before { 
 
     counter-increment: section; 
 

 
     content: "" counter(section,upper-roman) ". "; 
 
    } 
 

 
    h2:before { 
 
     counter-increment: subsection; 
 
     content: counter(section,upper-alpha) " "; 
 
    } 
 
    /* So on and so forth according to individual need*/
<body> 
 
    <h1> First section </h1> 
 
     <h2>First Subsection</h2> 
 
      <p> Enterprise to Kirk </p> 
 
     <h2>Second Subsection</h2> 
 
      <p> Come in Enterprise</p> 
 
     <h2>Third Subsection</h2> 
 
      <p> We are under attack.</p> 
 
    <h1> Second section </h1> 
 
     <h2>First Subsection</h2> 
 
     <h2>Second Subsection</h2> 
 
     <h2>Third Subsection</h2> 
 
</body>

我還學會了如何附加CSS文件,pandoc 的--css filepath.css添加到命令行

回答

1

你可以將id分配給所有具有attributes in pandoc's internal AST的元素(在包含images and links的新版本的pandoc版本中)。

您也可以隨時使用:<span id="foo">my text</span> that can be [referenced](#foo).

+0

我無法找到明確地說,你可以添加IDS中的任何元素的pandoc自述參考。大!不過,我認爲現在我會使用上面描述的技術,因爲我不喜歡在文本中添加太多標記。但這是我正在尋找的答案。謝謝!! – Mallow

+0

@Mallow高興我可以幫忙!只是很清楚:不幸的是,所有_all_元素都不支持屬性,爲了更清晰起見,我重新考慮了答案。 – mb21