Skip to content

Conversation

@adamdehaven
Copy link
Contributor

@adamdehaven adamdehaven commented Jan 11, 2025

Summary

Add a monaco-editor folding range provider to support folding mdc block components. Usage example has been added to the Editor.vue and README.

Originally, I was going to implement via the languages.LanguageConfiguration property as shown here:

folding: {
  markers: {
    start: /^\s*:{2,}([\w-]+)/, // Matches opening tags like "::component"
    end: /^\s*:{2,}$/, // Matches closing tags like "::"
  },
},

However, the implementation requires a custom folding range provider since we want to match the number of colon : characters for opening and ending tags.

This PR also updates the formatter to support ``` and ~~~ for code block fences.

Examples

MDC content:

# Code Folding

::container
  :::child-component
  Child component text
  :::
::

Hover state

cold folding hover state

Collapsed child block component

collapsed child block component

Collapsed parent block component

collapsed parent block component

Add a monaco-editor folding range provider to support folding mdc block components.
Also updates the formatter to support '```' and `~~~` for code block
fences.
Copy link
Collaborator

@farnabaz farnabaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks perfect 🔥

@farnabaz farnabaz merged commit e990198 into nuxt-content:main Jan 13, 2025
@adamdehaven adamdehaven deleted the feat/monaco-folding-range-provider branch January 13, 2025 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants