Skip to content

Multi region snippet support #3690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 tasks done
ciscoo opened this issue Mar 23, 2024 · 1 comment
Open
4 tasks done

Multi region snippet support #3690

ciscoo opened this issue Mar 23, 2024 · 1 comment
Labels
has-workaround Has workaround, low priority stale

Comments

@ciscoo
Copy link

ciscoo commented Mar 23, 2024

Is your feature request related to a problem? Please describe.

Only a single region in a code snippet is supported.

Here is a sample demonstrating the issue: https://stackblitz.com/edit/vite-2wp1zt?file=docs%2Fexample.md

Describe the solution you'd like

I would like to be able to do the following:

// #region snippet
import io.mateo.cxf.codegen.wsdl2java.Wsdl2Java
// #endregion snippet

plugins {
    id "java"
    id "io.mateo.cxf-codegen"
}

// #region snippet

// ...

tasks.register("example", Wsdl2Java) {
    toolOptions { // <2>
        wsdl.set(file("path/to/example.wsdl").toPath().toAbsolutePath().toString())
    }
    allJvmArgs = ["-Duser.language=fr", "-Duser.country=CA"]
}
// #endregion snippet

tasks.register("verify") {
    doLast {
        println tasks.getByName("example").wsdl2JavaOptions.wsdl.get()
    }
}

Which would render as:

import io.mateo.cxf.codegen.wsdl2java.Wsdl2Java

// ...

tasks.register("example", Wsdl2Java) {
    toolOptions { // <2>
        wsdl.set(file("path/to/example.wsdl").toPath().toAbsolutePath().toString())
    }
    allJvmArgs = ["-Duser.language=fr", "-Duser.country=CA"]
}

Describe alternatives you've considered

No response

Additional context

I'm working on migrating my project's documentation to VitePress from Asciidoctor which has support for multiple tagged regions

Validations

@brc-dd
Copy link
Member

brc-dd commented Apr 12, 2024

You can use this plugin - https://github.com/fabioaanthony/markdown-it-vuepress-code-snippet-enhanced

example:

// #foo
import { defineConfig } from 'vitepress'
import snippetPlugin from 'markdown-it-vuepress-code-snippet-enhanced'
// #foo

export default defineConfig({
  markdown: {
    // #foo
    config(md) {
      md.use(snippetPlugin)
    }
    // #foo
  }
})

usage:

@[code transcludeWith=#foo](@/path/to/file)

@brc-dd brc-dd added enhancement has-workaround Has workaround, low priority labels Apr 12, 2024
@github-actions github-actions bot added the stale label May 23, 2024
@github-actions github-actions bot removed the stale label Jan 20, 2025
@github-actions github-actions bot added the stale label Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-workaround Has workaround, low priority stale
Projects
None yet
Development

No branches or pull requests

2 participants