code blocks and blockquotes in between lists #801
-
How to get code blocks and blockquotes in between list to render as expected? # Lorem Ipsum Dolor
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
~~~C++
#aliquam <voluptatem>
int modi()
{
sunt::explicabo << "Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt." << sunt::voluptatem;
return 0;
}
~~~
- Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam.
- Eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
## Pirem Ipsum Lodor
1. Pirem Ipsum Lodor sit amet, consectetuer adipiscing elit.
1. Aenean commodo ligula eget dolor.
2. Aenean massa.
> Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
3. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.
~~~C++
#includent <ipsum_dolor>
int adipiscing() {
return 0;
}
void consectetur() {
ipsum::dolor::sit << "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." << consectetur::adipiscing::elit;
}
int nunc() {
int pellentesque = adipiscing();
for (int i = 0; i < pellentesque; ++i) {
consectetur();
}
return 0;
}
~~~
4. Nulla consequat massa quis enim.
2. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. Gets converted to: <h1 id="lorem-ipsum-dolor">Lorem Ipsum Dolor</h1>
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
<ul>
<li>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</li>
<li>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
~~~C++
#aliquam <voluptatem></voluptatem></li>
</ul>
<p>int modi()
{
sunt::explicabo « “Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.” « sunt::voluptatem;
return 0;
}
~~~
- Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam.</p>
</li>
<li>Eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.</li>
</ul>
<h2 id="pirem-ipsum-lodor">Pirem Ipsum Lodor</h2>
<ol>
<li>Pirem Ipsum Lodor sit amet, consectetuer adipiscing elit.
<ol>
<li>Aenean commodo ligula eget dolor.</li>
<li>Aenean massa.
> Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</li>
<li>Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.
~~~C++
#includent <ipsum_dolor>
int adipiscing() {
return 0;
}</ipsum_dolor></li>
</ol>
<p>void consectetur() {
ipsum::dolor::sit « “Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.” « consectetur::adipiscing::elit;
}</p>
<p>int nunc() {
int pellentesque = adipiscing();
for (int i = 0; i < pellentesque; ++i) {
consectetur();
}
return 0;
}
~~~
4. Nulla consequat massa quis enim.</p>
</li>
<li>Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.</li>
</ol>
Here, you will see that the lines that were supposed to be blockquoted or added to codeblocks, just mix with the previous list entry as plain text. If I choose to add a newline before starting the code block or blockquote (and remove the indent), the next list entry goes bad. (Can demonstrate in another comment). On the other hand, here is the GitHub markdown output: Lorem Ipsum Dolor
Pirem Ipsum Lodor
and the output I get from doing the same in <h1>Lorem Ipsum Dolor</h1>
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
<ul>
<li>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</li>
</ul>
<blockquote>
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
</blockquote>
<ul>
<li>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</li>
</ul>
<pre><code class="language-C++"> #aliquam <voluptatem>
int modi()
{
sunt::explicabo << "Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt." << sunt::voluptatem;
return 0;
}
</code></pre>
<ul>
<li>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam.</li>
</ul>
</li>
<li>Eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.</li>
</ul>
<h2>Pirem Ipsum Lodor</h2>
<ol>
<li>Pirem Ipsum Lodor sit amet, consectetuer adipiscing elit.
<ol>
<li>Aenean commodo ligula eget dolor.</li>
<li>Aenean massa.</li>
</ol>
<blockquote>
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
</blockquote>
<ol start="3">
<li>Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.</li>
</ol>
<pre><code class="language-C++">#includent <ipsum_dolor>
int adipiscing() {
return 0;
}
void consectetur() {
ipsum::dolor::sit << "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." << consectetur::adipiscing::elit;
}
int nunc() {
int pellentesque = adipiscing();
for (int i = 0; i < pellentesque; ++i) {
consectetur();
}
return 0;
}
</code></pre>
<ol start="4">
<li>Nulla consequat massa quis enim.</li>
</ol>
</li>
<li>Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.</li>
</ol> which seems a bit more desirable. And Lemmy converted output: <div class="card border-secondary card-body md-div"><h1 dir="auto">Lorem Ipsum Dolor</h1>
<ul dir="auto">
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
<ul dir="auto">
<li>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</li>
</ul>
<blockquote dir="auto">
<p dir="auto">Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
</blockquote>
<ul dir="auto">
<li>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</li>
</ul>
<pre><code class="hljs language-C++"><span class="hljs-meta">#aliquam <span class="hljs-string"><voluptatem></span></span>
<span class="hljs-function"><span class="hljs-type">int</span> <span class="hljs-title">modi</span><span class="hljs-params">()</span>
</span>{
sunt::explicabo << <span class="hljs-string">"Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt."</span> << sunt::voluptatem;
<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}
</code></pre>
<ul dir="auto">
<li>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam.</li>
</ul>
</li>
<li>Eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.</li>
</ul>
<h2 dir="auto">Pirem Ipsum Lodor</h2>
<ol dir="auto">
<li>Pirem Ipsum Lodor sit amet, consectetuer adipiscing elit.
<ol dir="auto">
<li>Aenean commodo ligula eget dolor.</li>
<li>Aenean massa.</li>
</ol>
<blockquote dir="auto">
<p dir="auto">Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
</blockquote>
<ol start="3" dir="auto">
<li>Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.</li>
</ol>
<pre><code class="hljs language-C++"><span class="hljs-meta">#includent <span class="hljs-string"><ipsum_dolor></span></span>
<span class="hljs-function"><span class="hljs-type">int</span> <span class="hljs-title">adipiscing</span><span class="hljs-params">()</span> </span>{
<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}
<span class="hljs-function"><span class="hljs-type">void</span> <span class="hljs-title">consectetur</span><span class="hljs-params">()</span> </span>{
ipsum::dolor::sit << <span class="hljs-string">"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."</span> << consectetur::adipiscing::elit;
}
<span class="hljs-function"><span class="hljs-type">int</span> <span class="hljs-title">nunc</span><span class="hljs-params">()</span> </span>{
<span class="hljs-type">int</span> pellentesque = <span class="hljs-built_in">adipiscing</span>();
<span class="hljs-keyword">for</span> (<span class="hljs-type">int</span> i = <span class="hljs-number">0</span>; i < pellentesque; ++i) {
<span class="hljs-built_in">consectetur</span>();
}
<span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}
</code></pre>
<ol start="4" dir="auto">
<li>Nulla consequat massa quis enim.</li>
</ol>
</li>
<li>Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.</li>
</ol>
</div> Which is also kinda similar. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
In case I use this: # Lorem Ipsum Dolor
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
~~~C++
#aliquam <voluptatem>
int modi()
{
sunt::explicabo << "Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt." << sunt::voluptatem;
return 0;
}
~~~
- Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam.
- Eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
## Pirem Ipsum Lodor
1. Pirem Ipsum Lodor sit amet, consectetuer adipiscing elit.
1. Aenean commodo ligula eget dolor.
2. Aenean massa.
> Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
3. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.
~~~C++
#includent <ipsum_dolor>
int adipiscing() {
return 0;
}
void consectetur() {
ipsum::dolor::sit << "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." << consectetur::adipiscing::elit;
}
int nunc() {
int pellentesque = adipiscing();
for (int i = 0; i < pellentesque; ++i) {
consectetur();
}
return 0;
}
~~~
4. Nulla consequat massa quis enim.
2. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. it makes the blockquotes and code blocks work, but breaks the next list entry. Lorem Ipsum Dolor
#aliquam <voluptatem>
int modi()
{
sunt::explicabo << "Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt." << sunt::voluptatem;
return 0;
}
Pirem Ipsum Lodor
#includent <ipsum_dolor>
int adipiscing() {
return 0;
}
void consectetur() {
ipsum::dolor::sit << "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." << consectetur::adipiscing::elit;
}
int nunc() {
int pellentesque = adipiscing();
for (int i = 0; i < pellentesque; ++i) {
consectetur();
}
return 0;
}
~~~
4. Nulla consequat massa quis enim.
2. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. This could have been a possible workaround, but since it breaks in other parsers, I'd rather not have it. |
Beta Was this translation helpful? Give feedback.
-
Command used: Tried the same with: |
Beta Was this translation helpful? Give feedback.
Thanks for the example!
The reason why the code blocks and blockquote is not converted is that you need to use a blank line between a paragraph and a code block/blockquote, see the syntax specification.
So by changing your example to the following, it will work as expected: