-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathghCodeBlock.html
43 lines (41 loc) · 1.47 KB
/
ghCodeBlock.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<script type="text/javascript">
fetch("https://raw.githubusercontent.com/anoopkini/{{include.repo}}/main/{{include.filepath}}")
.then(response => response.text())
.then(data => document.getElementById('code').textContent = data)
function toggleCodeWrapper(){
document.getElementById("code-wrapper").style.display="block";
document.getElementById("code-toggle").style.display="none";
}
</script>
<style>
.ghLink, .lcLink {
float:right;
padding:5px;
background-color: #fff;
font-size: x-small;
border-radius: 5px;
margin:2px;
}
#code-toggle{
border:1px solid #333;
border-radius: 2px;
padding:5px;
border-bottom: 5px solid #333;
border-right: 5px solid #333;
text-decoration: none;
cursor: pointer;
}
#code-wrapper{
display: none;
}
#code-toggle:active{
border-bottom: 2px solid #333;
border-right: 2px solid #333;
}
</style>
<span id="code-toggle" onclick="toggleCodeWrapper()">Show code</span>
<div id="code-wrapper" class="language-{{include.highlight}} highlighter-rouge">
<div class="highlight">
<pre class="highlight"><a class="ghLink" href="https://github.com/anoopkini/{{include.repo}}/blob/main/{{include.filepath}}" target="_blank">GitHub</a><a class="lcLink" href="{{include.lcurl}}" target="_blank">Leetcode</a><code><div id="code"></div></code></pre>
</div>
</div>