You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

markdownextensions.htm 15 kB

10 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <!DOCTYPE html>
  2. <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
  3. <!--[if gt IE 8]><!-->
  4. <html class="no-js" lang="en">
  5. <!--<![endif]-->
  6. <head>
  7. <meta charset="utf-8">
  8. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  9. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  10. <title>DocNet Markdown extensions - DocNet Documentation</title>
  11. <link rel="shortcut icon" href="favicon.ico">
  12. <link rel="stylesheet" href="css/theme.css" type="text/css" />
  13. <link rel="stylesheet" href="css/theme_colors.css" type="text/css" />
  14. <link rel="stylesheet" href="css/styles/vs.css">
  15. <link rel="stylesheet" href="css/font-awesome.4.5.0.min.css">
  16. </head>
  17. <body role="document">
  18. <div class="grid-for-nav">
  19. <nav data-toggle="nav-shift" class="nav-side stickynav">
  20. <div class="side-nav-search">
  21. <a href="index.htm"><i class="fa fa-home"></i> DocNet Documentation</a>
  22. <div role="search">
  23. <form id="search-form" class="form" action="Docnet_search.htm" method="get">
  24. <input type="text" name="q" placeholder="Search docs" />
  25. </form>
  26. </div>
  27. </div>
  28. <div class="menu menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
  29. <ul>
  30. <li class="tocentry"><a href="index.htm">Home</a>
  31. </li>
  32. <li class="tocentry"><a href="usage.htm">Usage</a>
  33. </li>
  34. <li class="tocentry">
  35. <span class="navigationgroup"><i class="fa fa-caret-right"></i> <a href="Configuration.htm">Configuration</a></span>
  36. </li>
  37. <li class="tocentry">
  38. <ul>
  39. <li><span class="navigationgroup"><i class="fa fa-caret-down"></i> <a href="Authoringcontent.htm">Authoring content</a></span></li>
  40. <li class="tocentry"><a href="themes.htm">Themes</a>
  41. </li>
  42. <li class="tocentry">
  43. <ul>
  44. <li><span class="navigationgroup"><i class="fa fa-caret-down"></i> <a href="WritingcontentusingMarkdown.htm">Writing content using Markdown</a></span></li>
  45. <li class="tocentry"><a href="markdownsupport.htm">Markdown support</a>
  46. </li>
  47. <li class="tocentry current"><a class="current" href="markdownextensions.htm">DocNet Markdown extensions</a>
  48. <ul class="currentrelative">
  49. <li class="tocentry"><a href="#alert-boxes">Alert boxes</a></li>
  50. <li class="tocentry"><a href="#font-awesome-icons">Font Awesome icons</a></li>
  51. <li class="tocentry"><a href="#tabs">Tabs</a></li>
  52. <li class="tocentry"><a href="#snippets">Snippets</a></li>
  53. <li class="tocentry"><a href="#include-files">Include files</a></li>
  54. </ul>
  55. </ul>
  56. </li>
  57. </ul>
  58. </li>
  59. <li class="tocentry"><a href="search.htm">Search</a>
  60. </li>
  61. <li class="tocentry"><a href="acknowledgements.htm">Acknowledgements</a>
  62. </li>
  63. <li class="tocentry"><a href="license.htm">License</a>
  64. </li>
  65. </ul>
  66. <div class="toc-footer">
  67. <span class="text-small">
  68. <hr/>
  69. <a href="https://github.com/FransBouma/DocNet" target="_blank">Made with <i class="fa fa-github"></i> DocNet</a>
  70. </span>
  71. </div>
  72. </div>
  73. &nbsp;
  74. </nav>
  75. <section data-toggle="nav-shift" class="nav-content-wrap">
  76. <nav class="nav-top" role="navigation" aria-label="top navigation">
  77. <i data-toggle="nav-top" class="fa fa-bars"></i>
  78. <a href="index.htm">DocNet Documentation</a>
  79. </nav>
  80. <div class="nav-content">
  81. <div role="navigation" aria-label="breadcrumbs navigation">
  82. <div class="breadcrumbs">
  83. <ul><li><a href="index.htm">Home</a></li> / <li><a href="Authoringcontent.htm">Authoring content</a></li> / <li><a href="WritingcontentusingMarkdown.htm">Writing content using Markdown</a></li> / <li><a href="markdownextensions.htm">DocNet Markdown extensions</a></li></ul>
  84. </div>
  85. <hr />
  86. </div>
  87. <div role="main">
  88. <div class="section">
  89. <h1 id="docnet-markdown-extensions">DocNet Markdown extensions<a class="headerlink" href="#docnet-markdown-extensions" title="Permalink to this headline"><i class="fa fa-link" aria-hidden="true"></i></a></h1>
  90. <p><code>Docnet</code> defines the following markdown extensions to make writing documentation easier. </p>
  91. <h2 id="alert-boxes">Alert boxes<a class="headerlink" href="#alert-boxes" title="Permalink to this headline"><i class="fa fa-link" aria-hidden="true"></i></a></h2>
  92. <p>To quickly define alert boxes, <code>Docnet</code> defines the <code>@alert</code> element. Three types of alerts are defined: <em>danger</em> (displayed in red), <em>warning</em> or <em>important</em> (displayed in yellow) and <em>info</em> or <em>neutral</em>, which is displayed in blue. You specify the type of the alert after the <code>@alert</code> statement using &#64;alert <em>name</em>. Close the <code>@alert</code> with <code>@end</code>.</p>
  93. <p>Below are examples for each alert box and the markdown used to create them. </p>
  94. <p>The markdown:</p>
  95. <pre class="nocode">@alert danger
  96. This is a dangerous text, it will be displayed in a danger alert box!
  97. @end
  98. </pre><p>results in</p>
  99. <div class="alert alert-danger"><span class="alert-title"><i class="fa fa-times-circle"></i> Danger!</span><p>This is a dangerous text, it will be displayed in a danger alert box!</p>
  100. </div><p>The markdown:</p>
  101. <pre class="nocode">@alert warning
  102. This is a warning text, it will be displayed in a warning alert box!
  103. @end
  104. </pre><p>results in</p>
  105. <div class="alert alert-warning"><span class="alert-title"><i class="fa fa-warning"></i> Warning!</span><p>This is a warning text, it will be displayed in a warning alert box!</p>
  106. </div><p>The markdown:</p>
  107. <pre class="nocode">@alert important
  108. This is an important text, it will be displayed in a warning/important alert box!
  109. @end
  110. </pre><p>results in</p>
  111. <div class="alert alert-warning"><span class="alert-title"><i class="fa fa-warning"></i> Important!</span><p>This is an important text, it will be displayed in a warning/important alert box!</p>
  112. </div><p>The markdown:</p>
  113. <pre class="nocode">@alert info
  114. This is an info text, it will be displayed in an info alert box!
  115. @end
  116. </pre><p>Results in</p>
  117. <div class="alert alert-info"><span class="alert-title"><i class="fa fa-info-circle"></i> Info</span><p>This is an info text, it will be displayed in an info alert box!</p>
  118. </div><p>The markdown:</p>
  119. <pre class="nocode">@alert tip
  120. This is a tip! It will be displayed in a tip alert box!
  121. @end
  122. </pre><p>Results in</p>
  123. <div class="alert alert-tip"><span class="alert-title"><i class="fa fa-info-circle"></i> Tip</span><p>This is a tip! It will be displayed in a tip alert box!</p>
  124. </div><h2 id="font-awesome-icons">Font Awesome icons<a class="headerlink" href="#font-awesome-icons" title="Permalink to this headline"><i class="fa fa-link" aria-hidden="true"></i></a></h2>
  125. <p>To specify a font-awesome icon, use <code>@fa-iconname</code>, where <em>iconname</em> is the name of the font-awesome icon.</p>
  126. <p>Example: To specify the font awesome icon for GitHub, use <code>@fa-github</code>, which will result in: <i class="fa fa-github"></i></p>
  127. <h2 id="tabs">Tabs<a class="headerlink" href="#tabs" title="Permalink to this headline"><i class="fa fa-link" aria-hidden="true"></i></a></h2>
  128. <p>It's very easy with <code>Docnet</code> to add a tab control with one or more tabs to the HTML with a simple set of markdown statements. The tab statements are converted into pure CSS3/HTML tabs, based on the work of <a href="http://codepen.io/fusco/pen/Wvzjrm" target="_blank">Joseph Fusco</a>.</p>
  129. <p>To start a Tab control, start with <code>@tabs</code> and end the tabs definition with <code>@endtabs</code>. Between those two statements, which each need to be suffixed with a newline, you define one or more tabs using <code>@tab</code> followed by the label text for that tab, followed by a newline. End your tab contents with <code>@end</code>.</p>
  130. <p>The following example shows two tabs, one with label 'First Tab' and one with 'Second Tab':</p>
  131. <pre class="nocode">@tabs
  132. @tab First Tab
  133. This is the text for the first tab. It's nothing special
  134. As you can see, it can deal with newlines as well.
  135. @end
  136. @tab Second Tab
  137. Now, the second tab however is very interesting. At least let's pretend it is!
  138. @end
  139. @endtabs
  140. </pre><p>will result in: </p>
  141. <div class="tab-wrap"><input type="radio" id="tab0_1" name="tabGroup1" class="tab" checked><label for="tab0_1">First Tab</label><input type="radio" id="tab1_1" name="tabGroup1" class="tab"><label for="tab1_1">Second Tab</label><div class="tab-content"><p>This is the text for the first tab. It's nothing special</p>
  142. <p>As you can see, it can deal with newlines as well. </p>
  143. </div><div class="tab-content"><p>Now, the second tab however is very interesting. At least let's pretend it is!</p>
  144. </div></div><h2 id="snippets">Snippets<a class="headerlink" href="#snippets" title="Permalink to this headline"><i class="fa fa-link" aria-hidden="true"></i></a></h2>
  145. <p>You can include snippets from other files as fenced code blocks using the directive <code>@snippet</code> which has the following syntax:</p>
  146. <p><code>@snippet language [file specification] pattern</code></p>
  147. <p>Here, <em>language</em> can be one of <code>cs</code>, <code>txt</code> or <code>xml</code>. If an unknown language is specified, <code>txt</code> is chosen. <em>Pattern</em> is used to determine which part of the file specified between <code>[]</code>
  148. is to be embedded at the spot of the <code>@snippet</code> fragment. This code is based on <a href="http://defrancea.github.io/Projbook/projbook.html#Pageextractormd" target="_blank">Projbook's extractor feature</a> and follows the same pattern system. </p>
  149. <p>Below, the method <code>GenerateToCFragment</code> is embedded in a C# fenced code block. This method is a DocNet method and is obtained directly from the source code. This shows the <code>@snippet</code>
  150. feature's power as it keeps the documentation in sync with the embedded code without the necessity of updating things. </p>
  151. <p>The following snippet, if the DocNet sourcecode is located at the spot reachable by the path below:</p>
  152. <pre class="nocode">@snippet cs [../../DocNet/src/DocNet/NavigationLevel.cs] GenerateToCFragment
  153. </pre><p>will result in:</p>
  154. <pre><code class="cs">/// &lt;summary&gt;
  155. /// Generates the ToC fragment for this element, which can either be a simple line or a full expanded menu.
  156. /// &lt;/summary&gt;
  157. /// &lt;param name=&quot;navigatedPath&quot;&gt;The navigated path to the current element, which doesn't necessarily have to be this element.&lt;/param&gt;
  158. /// &lt;param name=&quot;relativePathToRoot&quot;&gt;The relative path back to the URL root, e.g. ../.., so it can be used for links to elements in this path.&lt;/param&gt;
  159. /// &lt;returns&gt;&lt;/returns&gt;
  160. public override string GenerateToCFragment(NavigatedPath navigatedPath, string relativePathToRoot)
  161. {
  162. var fragments = new List&lt;string&gt;();
  163. if(!this.IsRoot)
  164. {
  165. fragments.Add(&quot;&lt;li class=\&quot;tocentry\&quot;&gt;&quot;);
  166. }
  167. if(navigatedPath.Contains(this))
  168. {
  169. // we're expanded. If we're not root and on the top of the navigated path stack, our index page is the page we're currently generating the ToC for, so
  170. // we have to mark the entry as 'current'
  171. if(navigatedPath.Peek() == this &amp;&amp; !this.IsRoot)
  172. {
  173. fragments.Add(&quot;&lt;ul class=\&quot;current\&quot;&gt;&quot;);
  174. }
  175. else
  176. {
  177. fragments.Add(&quot;&lt;ul&gt;&quot;);
  178. }
  179. // first render the level header, which is the index element, if present or a label. The root always has an __index element otherwise we'd have stopped at load.
  180. var elementStartTag = &quot;&lt;li&gt;&lt;span class=\&quot;navigationgroup\&quot;&gt;&lt;i class=\&quot;fa fa-caret-down\&quot;&gt;&lt;/i&gt; &quot;;
  181. var indexElement = this.IndexElement;
  182. if(indexElement == null)
  183. {
  184. fragments.Add(string.Format(&quot;{0}{1}&lt;/span&gt;&lt;/li&gt;&quot;, elementStartTag, this.Name));
  185. }
  186. else
  187. {
  188. if(this.IsRoot)
  189. {
  190. fragments.Add(indexElement.PerformGenerateToCFragment(navigatedPath, relativePathToRoot));
  191. }
  192. else
  193. {
  194. fragments.Add(string.Format(&quot;{0}&lt;a href=\&quot;{1}{2}\&quot;&gt;{3}&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&quot;, elementStartTag, relativePathToRoot, HttpUtility.UrlPathEncode(indexElement.TargetURL),
  195. this.Name));
  196. }
  197. }
  198. // then the elements in the container. Index elements are skipped here.
  199. foreach(var element in this.Value)
  200. {
  201. fragments.Add(element.GenerateToCFragment(navigatedPath, relativePathToRoot));
  202. }
  203. fragments.Add(&quot;&lt;/ul&gt;&quot;);
  204. }
  205. else
  206. {
  207. // just a link
  208. fragments.Add(string.Format(&quot;&lt;span class=\&quot;navigationgroup\&quot;&gt;&lt;i class=\&quot;fa fa-caret-right\&quot;&gt;&lt;/i&gt; &lt;a href=\&quot;{0}{1}\&quot;&gt;{2}&lt;/a&gt;&lt;/span&gt;&quot;,
  209. relativePathToRoot, HttpUtility.UrlPathEncode(this.TargetURL), this.Name));
  210. }
  211. if(!this.IsRoot)
  212. {
  213. fragments.Add(&quot;&lt;/li&gt;&quot;);
  214. }
  215. return string.Join(Environment.NewLine, fragments.ToArray());
  216. }
  217. </code></pre>
  218. <h2 id="include-files">Include files<a class="headerlink" href="#include-files" title="Permalink to this headline"><i class="fa fa-link" aria-hidden="true"></i></a></h2>
  219. <p>You can include other files in your markdown files using the directive <code>@@include(&quot;filename&quot;)</code>, where <code>filename</code> is the name of the file to include. The include system isn't recursive.
  220. The files to include are read from a special folder, specified under <code>IncludeSource</code> in the <a href="docnetjson.htm">docnet.json</a> file. If no <code>IncludeSource</code> directive is
  221. specified in the <a href="docnetjson.htm">docnet.json</a> file, the folder <code>Includes</code> is assumed. </p>
  222. <p>The directive <code>@@include(&quot;somehtmlinclude.htm&quot;)</code></p>
  223. <p>results in the contents of <code>somehtmlinclude.htm</code> being included at the spot where the @@include statement is given, as shown below:</p>
  224. <p>@@include(&quot;includedhtml.htm&quot;)</p>
  225. <p>You can also include markdown, which is then processed with the other markdown as if it's part of it. </p>
  226. <p>@@include(&quot;includedmarkdown.md&quot;)</p>
  227. </div>
  228. </div>
  229. <footer>
  230. <hr />
  231. <div role="contentinfo">
  232. Made with DocNet. Get your copy at: <a href='https://github.com/FransBouma/DocNet' target='_blank'>https://github.com/FransBouma/DocNet</a>.
  233. </div>
  234. </footer>
  235. </div>
  236. </section>
  237. </div>
  238. <script src="js/jquery-2.1.1.min.js"></script>
  239. <script src="js/modernizr-2.8.3.min.js"></script>
  240. <script src="js/highlight.pack.js"></script>
  241. <script src="js/theme.js"></script>
  242. </body>
  243. </html>

No Description

Contributors (1)