question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: New blank line around code fence rule does not respect callout/blockquote line prefixes for code fence

See original GitHub issue

Describe the Bug

New rule for empty line around code fences does not respect when a code fence is inside a blockquote or callout.

How to Reproduce

> [!callout-name]
> ```language-name
> myCode
> more code
> ```
> ```language-name
> different code
> ```

Enable empty line around code fences rule and lint.

Observed Output

> [!callout-name]

```language-name
> myCode
> more code
> ```

```language-name
> different code
> ```

The first blank line breaks the callout because of the missing >. The > has also been removed from the front of the code fence.

Expected Behavior

Adds blank lines around the code fence that are at the same level of blockquote/callout nesting as the code block. Keeps the starting line of the codeblock at the same level of blockquote callout nesting.

> [!callout-name]
>
> ```language-name
> myCode
> more code
> ```
>
> ```language-name
> different code
> ```
>

OR ignore codefences inside callouts/blockquotes if needed but please do not arbitrarily remove > in front of code fences! OR if codefences inside blockquotes/callouts are fundamentally contrary to this lint rule, please document that so that users will know not to turn it on! I check the diff in the release notes when updating the plugin, before turning on new rules, and did not see anything about this.

Device

  • Desktop
  • Mobile

Additional Context

I have not tested with plain blockquotes or nested blockquotes/callouts but I expect it to be similarly broken there. Use case: I use codeblocks inside callouts to get multi-column features via the excellent https://efemkay.github.io/obsidian-modular-css-layout/multi-column/ If this use case is contrary to the lint rule and I should not be using this lint rule, please document that.

PS: Thanks for all your work and updates on this plugin!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:24

github_iconTop GitHub Comments

2reactions
pjkaufmancommented, Jul 30, 2022

This bug should be fixed on master now. I plan on making a release either tonight or tomorrow, so it should be fixed in the release as well. Please let us know if the issue still exists.

2reactions
pjkaufmancommented, Jul 28, 2022

I wanted to let you know that I have not forgotten about this. But I am trying to think through how to properly handle tables and code fences in blockquotes. I am guessing I will need to ignore them in blockquotes on the initial pass and pass in the new line value after that, but that may not work for double nesting. I could grab the content up until the start of the last new line character if the table does not start a line and that could be used to create the proper new line beginning, but I have not yet decided if this has any flaws.

All in all, I have not forgotten about this, but there are some technical difficulties surrounding making the updates at this time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

markdown-lint/031-blanks-around-fences.md at master - GitHub
This rule is triggered when fenced code blocks are either not preceded or not followed by a blank line: Some text ``` Code...
Read more >
Markdown fails to render code blocks with blank lines when ...
GitLab flavored markdown wrongly terminate fenced code blocks when 1) block contains blank lines (which is frequent in code) AND 2) code ......
Read more >
A problem with backtick code fences - CommonMark Discussion
If we agree it's code but don't agree block vs inline, that's still rather good! IIUC the only exceptions are (1) empty lines...
Read more >
Implement ```-style (fenced) Markdown code blocks
A code fence consists of three or more backticks ``` or tildes ~~~ , indented by zero to three spaces. The opening fence...
Read more >
Snippet with prefix "``" (double backtick) not working for inline ...
I found an explanation for why backticks work as a prefix but the snippet suggestion must be manually triggered with Ctr/ + space...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found