rec*_*ion 441 markdown multimarkdown
我正在编写一份大型Markdown文档,并希望在开头放置一个类别的目录,它将提供指向文档中各个位置的链接.我怎样才能做到这一点?
我试过用
[a link](# MyTitle)
Run Code Online (Sandbox Code Playgroud)
MyTitle文档中的标题在哪里,这不起作用.
ube*_*ama 741
Github会自动从标题中解析锚标记.所以你可以做到以下几点:
[Custom foo description](#foo)
# Foo
Run Code Online (Sandbox Code Playgroud)
在上面的例子中,Foo标题生成了一个带有名称的锚标记foo
注意:#对于所有标题大小只有一个#,锚名称和锚名称之间没有空格,锚标记名称必须小写,并且如果是多字则用短划线分隔.
[click on this link](#my-multi-word-header)
### My Multi Word Header
Run Code Online (Sandbox Code Playgroud)
开箱即用pandoc.
Ste*_*ell 102
通过试验,我找到了一个解决方案<div…/>但使用了一个明显的解决方案是将您自己的锚点放在页面中的任何位置,因此:
<a name="abcde">
Run Code Online (Sandbox Code Playgroud)
之前和
</a>
Run Code Online (Sandbox Code Playgroud)
在你想要"链接"的行之后.然后是降价链接,如:
[link text](#abcde)
Run Code Online (Sandbox Code Playgroud)
文档中的任何地方都会带您到那里.
该<div…/>解决方案插入一个"虚拟"师刚刚添加的id属性,这是具有潜在破坏性的页面结构,但<a name="abcde"/>解决方案应该是相当无害的.
(PS:将锚点放在您想要链接的行中可能没问题,如下所示:
## <a name="head1">Heading One</a>
Run Code Online (Sandbox Code Playgroud)
但这取决于Markdown如何对待这一点.我注意到,例如,Stack Overflow应答格式化器对此感到满意!)
All*_*lly 72
这可能是过时的线程,但是在Github使用时在markdown中创建内部文档链接... 
(注意:小写#title)
    # Contents
     - [Specification](#specification) 
     - [Dependencies Title](#dependencies-title) 
    ## Specification
    Example text blah. Example text blah. Example text blah. Example text blah. 
Example text blah. Example text blah. Example text blah. Example text blah. 
Example text blah. Example text blah. Example text blah. Example text blah. 
Example text blah. Example text blah. 
    ## Dependencies Title
    Example text blah. Example text blah. Example text blah. Example text blah. 
Example text blah. Example text blah. Example text blah. Example text blah. 
Example text blah. Example text blah. Example text blah. Example text blah. 
Example text blah. Example text blah. 
Run Code Online (Sandbox Code Playgroud)
一个好问题,所以我编辑了我的答案;
-内部链接可以使用任何标题尺寸进行#,##,###,####
我创建了下面......一个简单的例子
 https://github.com/aogilvie/markdownLinkTest
app*_*ive 39
在pandoc中,如果您--toc在生成html时使用该选项,将生成一个目录,其中包含指向这些部分的链接,并返回到部分标题中的目录.它与pandoc写入的其他格式类似,如LaTeX,rtf,rst等.所以使用命令
pandoc --toc happiness.txt -o happiness.html
Run Code Online (Sandbox Code Playgroud)
这一点降价:
% True Happiness
Introduction
------------
Many have posed the question of true happiness.  In this blog post we propose to
solve it.
First Attempts
--------------
The earliest attempts at attaining true happiness of course aimed at pleasure. 
Soon, though, the downside of pleasure was revealed.
Run Code Online (Sandbox Code Playgroud)
会产生这个作为html的主体:
    <h1 class="title">
        True Happiness
    </h1>
    <div id="TOC">
        <ul>
            <li>
                <a href="#introduction">Introduction</a>
            </li>
            <li>
                <a href="#first-attempts">First Attempts</a>
            </li>
        </ul>
    </div>
    <div id="introduction">
        <h2>
            <a href="#TOC">Introduction</a>
        </h2>
        <p>
            Many have posed the question of true happiness. In this blog post we propose to solve it.
        </p>
    </div>
    <div id="first-attempts">
        <h2>
            <a href="#TOC">First Attempts</a>
        </h2>
        <p>
            The earliest attempts at attaining true happiness of course aimed at pleasure. Soon, though, the downside of pleasure was revealed.
        </p>
    </div>
Run Code Online (Sandbox Code Playgroud)
        fed*_*qui 28
只需遵循[text](#link)语法并遵循以下准则:
-例如,如果您有以下部分:
# 1. Python
# 2. c++
# 3. c++11
# 4. asp.net-core
Run Code Online (Sandbox Code Playgroud)
您可以使用以下方法添加参考:
[1. Python](#1-python)
[2. c++](#2-c)
[3. c++11](#3-c11)
[4. asp.net-core](#4-aspnet-core)
Run Code Online (Sandbox Code Playgroud)
注意如何asp.net-core变成aspnet-core、1. python变成1-python等。
dav*_*411 20
是的,markdown会这样做但你需要指定名称锚<a name='xyx'>.  
一个完整的例子,
这会创建链接
[tasks](#tasks)
稍后在文档中,您将创建命名锚(无论它被调用).
<a name="tasks">
   my tasks
</a>
Run Code Online (Sandbox Code Playgroud)
请注意,您也可以将它包裹在标题周围.
<a name="tasks">
### Agile tasks (created by developer)
</a>
Run Code Online (Sandbox Code Playgroud)
        hoi*_*jui 13
pandoc手册解释了如何使用标识符链接到标题.我没有检查其他解析器对此的支持,但据报道它在github上不起作用.
可以手动指定标识符:
## my heading text {#mht}
Some normal text here,
including a [link to the header](#mht).
Run Code Online (Sandbox Code Playgroud)
或者您可以使用自动生成的标识符.两者都在pandoc手册中详细解释.
注意:这仅适用于转换为HTML,LaTex,ConTeXt,Textile或AsciiDoc.
ePi*_*314 13
根据降价实现,这个问题似乎有不同的答案。
事实上,官方的 Markdown 文档对这个话题是沉默的。
在这种情况下,如果您想要一个可移植的解决方案,您可以使用 HTML。
在任何标题之前,或在同一标题行中,使用一些 HTML 标记定义一个 ID。
例如:<a id="Chapter1"></a>
您将在代码中看到这一点,但在呈现的文档中看不到。
在此处查看完整示例(在线和可编辑)。
## Content
* [Chapter 1](#Chapter1)
* [Chapter 2](#Chapter2)
<div id="Chapter1"></div>
## Chapter 1
Some text here.  
Some text here.
Some text here.
## Chapter 2 <span id="Chapter2"><span>
Some text here.  
Some text here.
Some text here.
Run Code Online (Sandbox Code Playgroud)
要测试此示例,您必须在内容列表和第一章之间添加一些额外的空间或降低窗口高度。
此外,请勿在 ID 名称中使用空格。
一些额外的事情要记住,如果雅曾经得到的花哨与标题中的符号是亚希望导航到...
# What this is about
------
#### Table of Contents
- [About](#what-this-is-about)
- [⚡ Sunopsis](#9889-tldr)
- [:gear: Grinders](#it-grinds-my-gears)
- [Attribution]
------
## ⚡ TLDR
Words for those short on time or attention.
___
## It Grinds my :gear:s
Here _`:gear:`_ is not something like ⚙ or ⛭
___
## ⛤ Attribution
Probably to much time at a keyboard
[Attribution]: #9956-attribution
Run Code Online (Sandbox Code Playgroud)
...喜欢的东西#,;,&,和:内标题字符串通常被忽略/条纹,而不是逃出来的,一个也可以使用引用链接样式做出快速的使用更方便。
笔记
GitHub支持
:word:提交,自述文件等中的语法。如果在那里感兴趣使用'em ,请参见gist(来自rxaviers)。在现代浏览器中几乎所有其他地方都可以使用十进制或十六进制。从备忘单W3Schools的是珀迪得心应手,尤其是在使用CSS
::before或::after伪元素的符号是你的风格。
以防万一有人想知道标题中的图像和其他链接如何解析为id...
- [Imaged](#alt-textbadge__examplehttpsexamplecom-to-somewhere)
## [![Alt Text][badge__example]](https://example.com) To Somewhere
[badge__example]:
  https://img.shields.io/badge/Left-Right-success.svg?labelColor=brown&logo=stackexchange
  "Eeak a mouse!"
Run Code Online (Sandbox Code Playgroud)
MarkDown渲染因位置而异,因此...
## methodName([options]) => <code>Promise</code>
Run Code Online (Sandbox Code Playgroud)
...在GitHub上将有一个元素,id例如...
id="methodnameoptions--promise"
Run Code Online (Sandbox Code Playgroud)
...其中如香草卫生将导致id的...
id="methodnameoptions-codepromisecode"
Run Code Online (Sandbox Code Playgroud)
...意味着从模板写入或编译MarkDown文件要么需要针对一种拖尾的方式,要么需要针对各种巧妙的方式(例如清除标题文本)添加配置和脚本逻辑。
Gitlab 使用GitLab Flavored Markdown (GFM)
这里“所有 Markdown 渲染的标头都会自动获取 ID”
可以使用鼠标来:
使用鼠标右键复制并保存链接
例如在 README.md 文件中,我有标题:
## series expansion formula of the Boettcher function
这给出了一个链接:
前缀可以删除,所以这里的链接很简单
file#header
Run Code Online (Sandbox Code Playgroud)
这里的意思是:
README.md#series-expansion-formula-of-the-boettcher-function
Run Code Online (Sandbox Code Playgroud)
现在它可以用作:
[series expansion formula of the Boettcher function](README.md#series-expansion-formula-of-the-boettcher-function)
也可以手动完成:用连字符替换空格。
现场示例在这里
|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           220016 次  |  
        
|   最近记录:  |