Adds 'copy code' functionality to include code module
This commit is contained in:
+4
-3
@@ -1,10 +1,11 @@
|
||||
{% capture samplecode %}{% include_relative {{include.file}} %}{% endcapture %}
|
||||
{% if include.k8slink %}{% capture ghlink %}https://github.com/kubernetes/kubernetes/blob/{{page.githubbranch}}{{include.k8slink}}{% endcapture %}{% endif %}
|
||||
{% if include.ghlink %}{% capture ghlink %}https://github.com/kubernetes/kubernetes.github.io/blob/master{{include.ghlink}}{% endcapture %}{% endif %}
|
||||
{% if include.k8slink %}{% capture ghlink %}https://raw.githubusercontent.com/kubernetes/kubernetes/blob/{{page.githubbranch}}{{include.k8slink}}{% endcapture %}{% endif %}
|
||||
{% if include.ghlink %}{% capture ghlink %}https://raw.githubusercontent.com/kubernetes/kubernetes.github.io/{{page.docsbranch}}{{include.ghlink}}{% endcapture %}{% endif %}
|
||||
{% capture mysample %}
|
||||
```{{include.language}}
|
||||
{{ samplecode | raw | strip }}
|
||||
```
|
||||
{: id="{{include.file | handleize}}"}
|
||||
{% endcapture %}
|
||||
<table class="includecode"><thead><tr><th>{% if ghlink %}<a href="{{ghlink}}">{% endif %}<code>{{include.file}}</code></a></th></tr></thead>
|
||||
<table class="includecode"><thead><tr><th>{% if ghlink %}<a href="{{ghlink}}" download="{{include.file}}">{% endif %}<code>{{include.file}}</code></a><img src="/images/copycode.svg" style="max-height:24px" onClick="copyCode('{{include.file | handleize}}')" title="Copy {{include.file}} to clipboard"></th></tr></thead>
|
||||
<tr><td>{{ mysample | markdownify }}</td></tr></table>
|
||||
Reference in New Issue
Block a user