Code Block inside a Code Block in markdown

Hi, I decided to use Joplin to make my college's coursework, and it was a good choice until I had recursion classes, I miss a feature (or I found a bug).
image

I made this to put a Markdown code block inside this code block, but the output is:
(next post)

Is there any way to make what I was intending ?

Thanks and sorry about my English.

image

Are nested fenced code blocks a standard markdown feature?
What you have put there is what I would expect to render - you are basically setting one overall markdown code block which contains markdown code within it that would therefore display verbatim with markdown syntax highlighting.

Having trouble working out what you are trying to achieve here. You are trying to set a code block with Markdown highlighting within a code block with Markdown highlighting?

Why not just set the whole lot in one block? I have used the type "text" here.

```text
func(par1, par2)
  func(par1, par2)
    func(par1, par2)
```

Outputs as:

func(par1, par2)
  func(par1, par2)
    func(par1, par2)

Not quite nested, in that you cannot set a whole code block with different highlighting within it, but if you want to display a fenced code block starting with three back-ticks and show those back-ticks you can enclose it all within a fenced code block of four back-ticks.

Example:

````text
```
A fenced code block
```
````

Output:

```
A fenced code block
```

Code highlighting can only be set using the very first set of four back-ticks i.e. the "real" start of the fenced code block.

2 Likes

My question was more asking from the OP as as far as I'm aware nested codeblocks aren't a Markdown feature, I was assuming that somehow the OP had used such a feature before as I can't see a way that it would work.

You can also use 3 ~s to escape backticks which I find looks neater on the few occasions I've needed it.

```md
text
```
2 Likes

Sorry, I was not clearly enough
This was my expected output:

This is what I was calling "block inside a block"

Where are you generating this from? As far as I know it isn't standard markdown as it should be displaying all the characters within the first codeblock without formatting.

You simply can achieve that by using hidden hyphen:

Sample of a code block
~­~­~
This is code
~­~­~

I have a Autohotkey shortcut for that. To achieve it without this work facilitator you have to type:

~ ALT 0 1 7 3 ~ ALT 0 1 7 3 ~ (Numpad, Windows)
or encode
~­~­~
to get
~­~­­~
uups!
~­~­­~
without being recognized as

uups!

You should note, that the code contains hidden symbols that will interfere results if using copy/paste.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.