Skip to content

Support passing through custom strings after the ``` language specifier #716

@flcdrg

Description

@flcdrg

Is the feature request related to a problem

I have been trying out the https://sli.dev/ library to make some coding-focused slides. It occured to me that it would be nice to use MarkdownSnippets to generate the .md files used by slidev, as then I can ensure the code is compilable/valid C#.

slidev can make use of the magic-move animations, which in turn are configured by adding an extra string after the Markdown code block language specifier. eg.

```csharp {*|4}
// before
public Circum(double radius)
{
  return 2 * Math.PI * radius;
}

You can see an example of the slides I've been working on at https://github.com/flcdrg/csharp-refactoring-slidev/, and the current slide Markdown is in https://github.com/flcdrg/csharp-refactoring-slidev/blob/main/slides.md.

The output gets rendered to https://flcdrg.github.io/csharp-refactoring-slidev/1, where you can see how I'm using the animation to demonstrate the changes made when performing various code refactorings.

Describe the solution

I think the ability to capture any 'parameters'/trailing strings after the snippet name, and then append those after the language specifier would allow this.

eg.

Having this:

snippet: EncapsulateVariable-before {*|2}

Could then generate this:

```cs {*|2}
....

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