Skip to content

Feature request: make code block fence configurable to support nested code blocks #3

@ngirard

Description

@ngirard

Hi there,

First, thank you for creating this nice extension!

I've run into an issue where I need to write markdown that includes examples of code blocks. Because mdlab uses triple backticks (```) to delimit its cells, it's not possible to have a triple-backtick code block inside a cell's content, as it prematurely closes the cell.

Current Behavior

A markdown document like this does not parse correctly:

````python
# This is an mdlab cell
def my_function():
  """
  Here is an example of how to use this function in the terminal.
  The following is just documentation text:

  ```bash
  # This inner code block breaks the mdlab parser
  python my_script.py --help
  ```
  """
  print("This cell is for demonstrating documentation.")
````

Proposed Solution

It would be a huge improvement if the code fence string could be made configurable in the VS Code settings. For example, a new setting like mdlab.notebook.fence could be introduced.

  • It could default to ``` for backward compatibility.
  • Users could change it to ````` or another custom string to avoid conflicts with their content.

This would allow users to easily write documentation or prompts that involve code blocks, which is a very common and important use case for a tool like this.

Thanks again for your great work on this project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions