I am documenting my company’s software. We have sample HTML and Javascript code.
I have some issues to include code snippets in the Homepage.
I don’t want the code to run or anything, I just want it to show up on homepage.
Have someone already made this happen ?
Thanks.
jeblister
I’m sure we can figure this out, but I need a bit more information about the issues you are having. If you can point me to a repo, that would be even better…
{{ if .IsHome )}}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
{{ end }}
I don’t want the code to run or anything, I just want it to show up on homepage.
Basic writing and formatting syntax - GitHub Docs - Do you need to include code in your documentation (markdown code block?), or are you trying to only include jQuery if .IsHome?
The question is rather confusing.
thank to @rdwatters in this topic Embedding multiple markdown files into homepage
I just write a bunch of markdown in a partial and then add markdownify after calling the partial.
So,i create layouts/partials/codes/columns.html:
<div class="columns">
<div class="column">1</div>
<div class="column">2</div>
<div class="column">3</div>
<div class="column">4</div>
<div class="column">5</div>
</div>
Then in layouts/index.html
i call:
{{partial "codes/columns.html" . | markdownify }}
And i get the following output:
<pre><code class="language-html"><div class="columns">
<div class="column">1</div>
<div class="column">2</div>
<div class="column">3</div>
<div class="column">4</div>
<div class="column">5</div>
</div>
</code></pre>
I have also a syntax highlighting in client side (I set up highlighting.js as described in the Hugo documentation site:).
Is there other alternative to do that with syntax highlighting ?