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
2 changes: 1 addition & 1 deletion test/functional/test_site/expected/siteData.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
},
{
"src": "testCodeBlocks.md",
"title": "Code Blocks Line Splitting",
"title": "Test: Code Blocks",
"layout": "default",
"globalOverrideProperty": "Overridden by global override",
"globalAndFrontMatterOverrideProperty": "Overridden by global override",
Expand Down
34 changes: 21 additions & 13 deletions test/functional/test_site/expected/testCodeBlocks.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="MarkBind 2.14.1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Code Blocks Line Splitting</title>
<title>Test: Code Blocks</title>
<link rel="stylesheet" href="markbind/css/bootstrap.min.css">
<link rel="stylesheet" href="markbind/css/bootstrap-vue.min.css">
<link rel="stylesheet" href="markbind/fontawesome/css/all.min.css">
Expand All @@ -26,33 +26,41 @@
<div id="app">
<div id="flex-body">
<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<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>{<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><br></span><span>-----<br></span></code></pre>
<p><strong>start-from attr causes inline style to be set</strong></p>
<p><strong>Test: Code blocks</strong></p>
<p><strong>Normal fenced code should render correctly</strong></p>
<pre><code class="hljs"><span>Content in a fenced code block<br></span></code></pre>
<p><strong>With syntax coloring should render correctly</strong></p>
<pre><code class="hljs xml"><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>
<p><strong><code>no-line-numbers</code> attr should hide corresponding line numbers</strong></p>
<pre><code class="no-line-numbers hljs xml"><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>
<p><strong><code>start-from</code> attr should set inline css in <code>&lt;code&gt;</code> tag, enabling lines to start from a specific line number</strong></p>
<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>
<p><strong><code>highlight-lines</code> attr causes corresponding lines to have 'highlighted' class</strong></p>
<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>
<p><strong><code>highlight-lines</code> attr with <code>start-from</code> attr should cause corresponding lines to have 'highlighted' class based on <code>start-from</code></strong></p>
<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>
<p><strong>Should render correctly with 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;<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>
<p><strong>Inline markdown contained in heading should also be rendered correctly</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;<br></span><span> &lt;bar&gt;<br></span><span>&lt;/foo&gt;<br></span></code></pre>
</div>
</div>
<p><strong>Code block with multiple linebreaks should not have the empty lines collapsed</strong></p>
<pre><code class="hljs"><span><br></span><span>Four empty lines below, one above<br></span><span><br></span><span><br></span><span><br></span><span><br></span><span>Four empty lines above, one below<br></span><span><br></span></code></pre>
<p><strong>Code block without line numbers and multiple linebreaks should not have the empty lines collapsed</strong></p>
<pre><code class="no-line-numbers hljs"><span><br></span><span>Four empty lines below, one above<br></span><span><br></span><span><br></span><span><br></span><span><br></span><span>Four empty lines above, one below<br></span><span><br></span></code></pre>
<p><strong>Code block with syntax highlighting and multiple linebreaks should not have the empty lines collapsed</strong></p>
<pre><code class="hljs js"><span><br></span><span><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">fourEmptyLinesBelowOneAbove</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, one below</span><br></span><span><br></span></code></pre>
<p><strong>span with <code>hljs</code> class should span multiple lines <a href="https://github.com/MarkBind/markbind/pull/991#issuecomment-586547275">(Link for context)</a></strong></p>
<pre><code class="hljs markdown"><span><span class="hljs-strong">*****</span><br></span><span>-----<br></span></code></pre>
</div>


Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_site/site.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
{
"src": "testCodeBlocks.md",
"title": "Code Blocks Line Splitting"
"title": "Test: Code Blocks"
},
{
"src": "testIncludePluginsRendered.md",
Expand Down
89 changes: 64 additions & 25 deletions test/functional/test_site/testCodeBlocks.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,34 @@
**Code blocks test**
**Test: Code blocks**

**Multiple linebreaks, no highlight**
**Normal fenced code should render correctly**

```
Four empty lines below




Four empty lines above
Content in a fenced code block
```

**Multiple linebreaks, with highlight**

```js
function fourEmptyLinesBelow() {

**With syntax coloring should render correctly**



} // four empty lines above
```xml
<foo>
<bar type="name">goo</bar>
</foo>
```

**hljs span spanning multiple lines**
**`no-line-numbers` attr should hide corresponding line numbers**

```markdown
*****
-----
```xml {.no-line-numbers}
<foo>
<bar type="name">goo</bar>
</foo>
```

**start-from attr causes inline style to be set**
**`start-from` attr should set inline css in `<code>` tag, enabling lines to start from a specific line number**
```markdown {start-from=30}
*****
-----
```

**highlight-lines attr causes corresponding lines to have 'highlighted' class**
**`highlight-lines` attr causes corresponding lines to have 'highlighted' class**
```markdown {highlight-lines="1,3,5-8"}
1 highlighted
2
Expand All @@ -49,7 +42,7 @@ function fourEmptyLinesBelow() {
10
```

**highlight-lines attr with start-from attr cause corresponding lines to have 'highlighted' class based on 'start-from'**
**`highlight-lines` attr with `start-from` attr should cause corresponding lines to have 'highlighted' class based on `start-from`**
```markdown {start-from=11 highlight-lines="11,13,15-18"}
11 highlighted
12
Expand All @@ -63,18 +56,64 @@ function fourEmptyLinesBelow() {
20
```

**Code block heading**
**Should render correctly with heading**

```{heading="A heading"}
<foo>
<bar>
</foo>
```

**Code block heading with inline markdown**
**Inline markdown contained in heading should also be rendered correctly**

```{heading="**Bold**, _Italic_, ___Bold and Italic___, ~~Strike through~~, ****Super Bold****, ++Underline++, ==Highlight==, :+1: :exclamation: :x: :construction:<br>We support page breaks"}
<foo>
<bar>
</foo>
```

**Code block with multiple linebreaks should not have the empty lines collapsed**

```

Four empty lines below, one above




Four empty lines above, one below

```

**Code block without line numbers and multiple linebreaks should not have the empty lines collapsed**

```{.no-line-numbers}

Four empty lines below, one above




Four empty lines above, one below

```

**Code block with syntax highlighting and multiple linebreaks should not have the empty lines collapsed**

```js

function fourEmptyLinesBelowOneAbove() {




} // four empty lines above, one below

```

**span with `hljs` class should span multiple lines [(Link for context)](https://github.com/MarkBind/markbind/pull/991#issuecomment-586547275)**

```markdown
*****
-----
```