mirror of
				https://github.com/gohugoio/hugo.git
				synced 2024-05-11 05:54:58 +00:00 
			
		
		
		
	Switching docs highlighting to highlight.js .. Docs build super fast again!
This commit is contained in:
		@@ -37,7 +37,8 @@ Some shortcodes use or require closing shortcodes. Like HTML, the opening and cl
 | 
			
		||||
shortcodes match (name only), the closing being prepended with a slash.
 | 
			
		||||
 | 
			
		||||
Example of a paired shortcode:
 | 
			
		||||
{{% highlight go %}} A bunch of code here {{% /highlight %}} 
 | 
			
		||||
 | 
			
		||||
    {{ % highlight go %}} A bunch of code here {{ % /highlight %}} 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Hugo Shortcodes
 | 
			
		||||
@@ -54,8 +55,9 @@ Highlight takes exactly one required parameter of language and requires a
 | 
			
		||||
closing shortcode.
 | 
			
		||||
 | 
			
		||||
#### Example
 | 
			
		||||
{{% highlight html %}}
 | 
			
		||||
    {{% highlight html %}}
 | 
			
		||||
The example has an extra space between the “{{” and “%” characters to prevent rendering here.
 | 
			
		||||
 | 
			
		||||
    {{ % highlight html %}}
 | 
			
		||||
    <section id="main">
 | 
			
		||||
      <div>
 | 
			
		||||
       <h1 id="title">{{ .Title }}</h1>
 | 
			
		||||
@@ -64,13 +66,11 @@ closing shortcode.
 | 
			
		||||
        {{ end }}
 | 
			
		||||
      </div>
 | 
			
		||||
    </section>
 | 
			
		||||
    {{% /highlight %}}
 | 
			
		||||
{{% /highlight %}}
 | 
			
		||||
    {{ % /highlight %}}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#### Example Output
 | 
			
		||||
 | 
			
		||||
{{% highlight html %}}
 | 
			
		||||
    <span style="color: #f92672"><section</span> <span style="color: #a6e22e">id=</span><span style="color: #e6db74">"main"</span><span style="color: #f92672">></span>
 | 
			
		||||
      <span style="color: #f92672"><div></span>
 | 
			
		||||
       <span style="color: #f92672"><h1</span> <span style="color: #a6e22e">id=</span><span style="color: #e6db74">"title"</span><span style="color: #f92672">></span>{{ .Title }}<span style="color: #f92672"></h1></span>
 | 
			
		||||
@@ -79,7 +79,6 @@ closing shortcode.
 | 
			
		||||
        {{ end }}
 | 
			
		||||
      <span style="color: #f92672"></div></span>
 | 
			
		||||
    <span style="color: #f92672"></section></span>
 | 
			
		||||
{{% /highlight %}}
 | 
			
		||||
 | 
			
		||||
### figure
 | 
			
		||||
Figure is simply an extension of the image capabilities present with Markdown.
 | 
			
		||||
@@ -98,16 +97,18 @@ figure can use the following parameters
 | 
			
		||||
 * alt
 | 
			
		||||
 | 
			
		||||
#### Example
 | 
			
		||||
*Example has an extra space so Hugo doesn't actually render it*.
 | 
			
		||||
 | 
			
		||||
{{% highlight html %}}
 | 
			
		||||
    {{% figure src="/media/spf13.jpg" title="Steve Francia" %}}
 | 
			
		||||
{{% /highlight %}}
 | 
			
		||||
    {{ % figure src="/media/spf13.jpg" title="Steve Francia" %}}
 | 
			
		||||
 | 
			
		||||
#### Example output
 | 
			
		||||
 | 
			
		||||
{{% highlight html %}}
 | 
			
		||||
 | 
			
		||||
{{% /highlight %}}
 | 
			
		||||
    <figure>
 | 
			
		||||
        <img src="/media/spf13.jpg"  />
 | 
			
		||||
        <figcaption>
 | 
			
		||||
            <h4>Steve Francia</h4>
 | 
			
		||||
        </figcaption>
 | 
			
		||||
    </figure>
 | 
			
		||||
 | 
			
		||||
## Creating your own shortcodes
 | 
			
		||||
 | 
			
		||||
@@ -173,6 +174,7 @@ This would be rendered as
 | 
			
		||||
    {{ % img src="/media/spf13.jpg" title="Steve Francia" %}}
 | 
			
		||||
 | 
			
		||||
Would load the template /layouts/shortcodes/img.html
 | 
			
		||||
 | 
			
		||||
    <!-- image -->
 | 
			
		||||
    <figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
 | 
			
		||||
        {{ with .Get "link"}}<a href="{{.}}">{{ end }}
 | 
			
		||||
@@ -206,11 +208,9 @@ Would be rendered as:
 | 
			
		||||
 | 
			
		||||
*Example has an extra space so Hugo doesn't actually render it*.
 | 
			
		||||
 | 
			
		||||
    {{% highlight html %}}
 | 
			
		||||
    <html>
 | 
			
		||||
        <body> This HTML </body>
 | 
			
		||||
    </html>
 | 
			
		||||
    {{% /highlight %}}
 | 
			
		||||
 | 
			
		||||
The template for this utilizes the following code (already include in hugo)
 | 
			
		||||
    {{ .Get 0 | highlight .Inner  }}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user