1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Fixed line highlighting

This commit is contained in:
Uncled1023 2018-06-23 01:21:59 -07:00
parent 712833c9d7
commit 50e16d87cb
4 changed files with 8 additions and 7 deletions

View File

@ -6,7 +6,7 @@
string format = Model.Syntax;
string formatName = "Text";
if (HighlightHelper.Languages.ContainsKey(format))
if (!string.IsNullOrEmpty(format) && HighlightHelper.Languages.ContainsKey(format))
{
formatName = HighlightHelper.Languages[format];
}
@ -48,7 +48,7 @@
<br />
<div class="row">
<div class="col-sm-12">
<pre class="line-numbers"><code class="language-@(format)">@Model.Content</code></pre>
<pre class="line-numbers" id="code"><code class="language-@(format)">@Model.Content</code></pre>
</div>
</div>
</div>

View File

@ -4,7 +4,8 @@
Layout = null;
string format = Model.Syntax;
string formatName = "Text";
if (HighlightHelper.Languages.ContainsKey(format))
if (!string.IsNullOrEmpty(format) && HighlightHelper.Languages.ContainsKey(format))
{
formatName = HighlightHelper.Languages[format];
}
@ -26,7 +27,7 @@
</head>
<body data-twttr-rendered="true">
<pre class="line-numbers"><code class="language-@(format)">@Model.Content</code></pre>
<pre class="line-numbers" id="code" style="border: none;"><code class="language-@(format)">@Model.Content</code></pre>
<bundle src="js/common.min.js" append-version="true"></bundle>
<bundle src="js/paste.view.min.js" append-version="true"></bundle>

View File

@ -4,7 +4,7 @@
string format = Model.Paste.Syntax;
string formatName = "Text";
if (HighlightHelper.Languages.ContainsKey(format))
if (!string.IsNullOrEmpty(format) && HighlightHelper.Languages.ContainsKey(format))
{
formatName = HighlightHelper.Languages[format];
}
@ -39,7 +39,7 @@
}
else
{
<pre class="line-numbers"><code class="language-@(format)">@Model.Paste.Content</code></pre>
<pre class="line-numbers" id="code-@(Model.VaultItemId)"><code class="language-@(format)">@Model.Paste.Content</code></pre>
}
</div>
<div class="show-more" id="show-more-bottom-@Model.VaultItemId">

View File

@ -118,7 +118,7 @@ function applyHash() {
highlightLines(pre, range, 'temporary ');
document.querySelector('.temporary.line-highlight').scrollIntoView();
document.querySelector('.temporary.line-highlight').scrollIntoView();
}
var fakeTimer = 0; // Hack to limit the number of times applyHash() runs