Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/lib/markbind/src/lib/markdown-it/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ markdownIt.renderer.rules.fence = (tokens, idx, options, env, slf) => {
lines.pop(); // last line is always a single '\n' newline, so we remove it
// wrap all lines with <span> so we can number them
str = lines.map((line, index) => {
// if a line is empty we put a 0 width non breaking space
const content = line || '&#x200B;';
const currentLineNumber = index + 1;
// check if there is at least one range or line number that matches the current line number
// Note: The algorithm is based off markdown-it-highlight-lines (https://github.com/egoist/markdown-it-highlight-lines/blob/master/src/index.js)
Expand All @@ -123,9 +121,9 @@ markdownIt.renderer.rules.fence = (tokens, idx, options, env, slf) => {
return currentLineNumber === start;
});
if (inRange) {
return `<span class="highlighted">${content}</span>`;
return `<span class="highlighted">${line}<br></span>`;
}
return `<span>${content}</span>`;
return `<span>${line}<br></span>`;
}).join('');

token.attrJoin('class', 'hljs');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p>A commonly used format for writing user stories is:<br>
<strong><code>As a</code></strong> <code>&lt;use type/role&gt;</code> <strong><code>I can</code></strong> <code>&lt;function&gt;</code> <strong><code>so that</code></strong> <code>&lt;benefit&gt;</code></p>
<p>Here are some examples of user stories for the IVLE system:</p>
<pre><code class="hljs bat"><span>* As a student, I can download files uploaded by lecturers, so that I can get my own <span class="hljs-built_in">copy</span> of the files.</span><span>* As a lecturer, I can create discussion forums, so that students can discuss things online.</span><span>* As a tutor, I can <span class="hljs-built_in">print</span> attendance sheets, so that I can take attendance during the class.</span></code></pre>
<pre><code class="hljs bat"><span>* As a student, I can download files uploaded by lecturers, so that I can get my own <span class="hljs-built_in">copy</span> of the files.<br></span><span>* As a lecturer, I can create discussion forums, so that students can discuss things online.<br></span><span>* As a tutor, I can <span class="hljs-built_in">print</span> attendance sheets, so that I can take attendance during the class.<br></span></code></pre>
<p>The <code>&lt;benefit&gt;</code> can be omitted if it is obvious. E.g. As a tutor, I can print attendance sheets.
User stories are mainly used for early estimation and scheduling purposes.</p>
<p>According to <ref xp-website="">this<ref></ref>, the biggest difference between user stories and traditional requirements
Expand Down
16 changes: 8 additions & 8 deletions test/functional/test_site/expected/testCodeBlocks.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,29 @@
<div id="content-wrapper">
<p><strong>Code blocks test</strong></p>
<p><strong>Multiple linebreaks, no highlight</strong></p>
<pre><code class="hljs"><span>Four empty lines below</span><span>&#x200B;</span><span>&#x200B;</span><span>&#x200B;</span><span>&#x200B;</span><span>Four empty lines above</span></code></pre>
<pre><code class="hljs"><span>Four empty lines below<br></span><span><br></span><span><br></span><span><br></span><span><br></span><span>Four empty lines above<br></span></code></pre>
<p><strong>Multiple linebreaks, with highlight</strong></p>
<pre><code class="hljs js"><span><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">fourEmptyLinesBelow</span>(<span class="hljs-params"></span>) </span>{</span><span>&#x200B;</span><span>&#x200B;</span><span>&#x200B;</span><span>&#x200B;</span><span>} <span class="hljs-comment">// four empty lines above</span></span></code></pre>
<pre><code class="hljs js"><span><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">fourEmptyLinesBelow</span>(<span class="hljs-params"></span>) </span>{<br></span><span><br></span><span><br></span><span><br></span><span><br></span><span>} <span class="hljs-comment">// four empty lines above</span><br></span></code></pre>
<p><strong>hljs span spanning multiple lines</strong></p>
<pre><code class="hljs markdown"><span><span class="hljs-strong">*****</span></span><span>-----</span></code></pre>
<pre><code class="hljs markdown"><span><span class="hljs-strong">*****</span><br></span><span>-----<br></span></code></pre>
<p><strong>start-from attr causes inline style to be set</strong></p>
<pre><code style="counter-reset: line 29;" class="hljs markdown"><span><span class="hljs-strong">*****</span></span><span>-----</span></code></pre>
<pre><code style="counter-reset: line 29;" class="hljs markdown"><span><span class="hljs-strong">*****</span><br></span><span>-----<br></span></code></pre>
<p><strong>highlight-lines attr causes corresponding lines to have 'highlighted' class</strong></p>
<pre><code class="hljs markdown"><span class="highlighted">1 highlighted</span><span>2</span><span class="highlighted">3 highlighted</span><span>4</span><span class="highlighted">5 highlighted</span><span class="highlighted">6 highlighted</span><span class="highlighted">7 highlighted</span><span class="highlighted">8 highlighted</span><span>9</span><span>10</span></code></pre>
<pre><code class="hljs markdown"><span class="highlighted">1 highlighted<br></span><span>2<br></span><span class="highlighted">3 highlighted<br></span><span>4<br></span><span class="highlighted">5 highlighted<br></span><span class="highlighted">6 highlighted<br></span><span class="highlighted">7 highlighted<br></span><span class="highlighted">8 highlighted<br></span><span>9<br></span><span>10<br></span></code></pre>
<p><strong>highlight-lines attr with start-from attr cause corresponding lines to have 'highlighted' class based on 'start-from'</strong></p>
<pre><code style="counter-reset: line 10;" class="hljs markdown"><span class="highlighted">11 highlighted</span><span>12</span><span class="highlighted">13 highlighted</span><span>14</span><span class="highlighted">15 highlighted</span><span class="highlighted">16 highlighted</span><span class="highlighted">17 highlighted</span><span class="highlighted">18 highlighted</span><span>19</span><span>20</span></code></pre>
<pre><code style="counter-reset: line 10;" class="hljs markdown"><span class="highlighted">11 highlighted<br></span><span>12<br></span><span class="highlighted">13 highlighted<br></span><span>14<br></span><span class="highlighted">15 highlighted<br></span><span class="highlighted">16 highlighted<br></span><span class="highlighted">17 highlighted<br></span><span class="highlighted">18 highlighted<br></span><span>19<br></span><span>20<br></span></code></pre>
<p><strong>Code block heading</strong></p>
<div class="code-block">
<div class="code-block-heading"><span>A heading</span></div>
<div class="code-block-content">
<pre><code heading="A heading" class="hljs"><span>&lt;foo&gt;</span><span> &lt;bar&gt;</span><span>&lt;/foo&gt;</span></code></pre>
<pre><code heading="A heading" class="hljs"><span>&lt;foo&gt;<br></span><span> &lt;bar&gt;<br></span><span>&lt;/foo&gt;<br></span></code></pre>
</div>
</div>
<p><strong>Code block heading with inline markdown</strong></p>
<div class="code-block">
<div class="code-block-heading inline-markdown-heading"><span><strong>Bold</strong>, <em>Italic</em>, <em><strong>Bold and Italic</strong></em>, <s>Strike through</s>, <strong><strong>Super Bold</strong></strong>, <ins>Underline</ins>, <mark>Highlight</mark>, 👍 ❗️ ❌ 🚧<br>We support page breaks</span></div>
<div class="code-block-content">
<pre><code heading="**Bold**, _Italic_, ___Bold and Italic___, ~~Strike through~~, ****Super Bold****, ++Underline++, ==Highlight==, :+1: :exclamation: :x: :construction:&lt;br&gt;We support page breaks" class="hljs"><span>&lt;foo&gt;</span><span> &lt;bar&gt;</span><span>&lt;/foo&gt;</span></code></pre>
<pre><code heading="**Bold**, _Italic_, ___Bold and Italic___, ~~Strike through~~, ****Super Bold****, ++Underline++, ==Highlight==, :+1: :exclamation: :x: :construction:&lt;br&gt;We support page breaks" class="hljs"><span>&lt;foo&gt;<br></span><span> &lt;bar&gt;<br></span><span>&lt;/foo&gt;<br></span></code></pre>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_site/expected/testTooltipSpacing.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<div id="flex-body">
<div id="content-wrapper">
<h1 id="569-stray-space-after-tooltip">569: Stray space after tooltip<a class="fa fa-anchor" href="#569-stray-space-after-tooltip"></a></h1>
<pre><code class="hljs"><span>&lt;tooltip&gt;tooltip&lt;/tooltip&gt;, test</span><span>&#x200B;</span><span>&lt;trigger&gt;trigger&lt;/trigger&gt;, test</span></code></pre>
<pre><code class="hljs"><span>&lt;tooltip&gt;tooltip&lt;/tooltip&gt;, test<br></span><span><br></span><span>&lt;trigger&gt;trigger&lt;/trigger&gt;, test<br></span></code></pre>
<p><span data-mb-component-type="tooltip" v-b-tooltip.hover.top.html="tooltipInnerContentGetter" class="trigger">tooltip</span>, test</p>
<p><span v-b-popover.hover.top.html="popoverGenerator" v-b-tooltip.hover.top.html="tooltipContentGetter" v-on:mouseover="$refs['undefined'].show()" class="trigger">trigger</span>, test</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h1 id="heading-1">Heading 1<a class="fa fa-anchor" href="#heading-1"></a></h1>
</li>
</ul>
<p><strong>A <code>code</code> example:</strong></p>
<pre><code class="hljs html"><span><span class="hljs-tag">&lt;<span class="hljs-name">foo</span>&gt;</span></span><span> <span class="hljs-tag">&lt;<span class="hljs-name">bar</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"name"</span>&gt;</span>goo<span class="hljs-tag">&lt;/<span class="hljs-name">bar</span>&gt;</span></span><span><span class="hljs-tag">&lt;/<span class="hljs-name">foo</span>&gt;</span></span></code></pre>
<pre><code class="hljs html"><span><span class="hljs-tag">&lt;<span class="hljs-name">foo</span>&gt;</span><br></span><span> <span class="hljs-tag">&lt;<span class="hljs-name">bar</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"name"</span>&gt;</span>goo<span class="hljs-tag">&lt;/<span class="hljs-name">bar</span>&gt;</span><br></span><span><span class="hljs-tag">&lt;/<span class="hljs-name">foo</span>&gt;</span><br></span></code></pre>
<h2 id="sub-heading-1-1">Sub Heading 1.1<a class="fa fa-anchor" href="#sub-heading-1-1"></a></h2>
<p>A <span effect="scale" placement="top" trigger="hover" data-mb-component-type="tooltip" v-b-tooltip.hover.top.html="tooltipInnerContentGetter" class="trigger"><span data-mb-html-for="_content">❗️ some <strong>important explanation</strong></span>tooltip</span>, a <span for="modal:modalinfo" trigger="click" v-b-popover.click.top.html="popoverGenerator" v-b-tooltip.click.top.html="tooltipContentGetter" v-on:click="$refs['modal:modalinfo'].show()" class="trigger-click">modal</span>, a <a href="https://markbind.org/">link</a>, a <span class="badge badge-danger">badge</span>, another <span class="badge badge-warning">badge</span>.</p>
<b-modal id="modal:modalinfo" hide-footer="" size="" modal-class="mb-zoom" ref="modal:modalinfo"><template slot="modal-title">Modal Title</template>
Expand Down