Skip to content
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

Use multiple languages in one code block #46

Open
LONGACAT opened this issue Dec 8, 2024 · 1 comment
Open

Use multiple languages in one code block #46

LONGACAT opened this issue Dec 8, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@LONGACAT
Copy link

LONGACAT commented Dec 8, 2024

Support for multiple languages in one code block would be nice to have

Example mockup of what I mean:

image

Here lines 1-2, 6-8 use no language, 3-5 use rs and 9-13 use c. Something similar to the annotations option could work? E.g.

#codly(languages-in-block: (
  (
    start: 2,
    end: 4,
    language: "rs",
  ),
  (
    start: 8,
    end: 12,
    language: "c",
  ),
))
```
You can view a file with:
$ cat main.rs
pub fn main() {
    println!("Hello, world!");
}

Here's another one:
$ cat main.c
#include <stdio.h>
int main() {
   printf("Hello, world!");
   return 0;
}
```

Not sure how would it work with language boxes, I made a mockup for that as well:

image
It could either be automatic when languages get switched or manual (or selectable) with something like the following:

#codly(language-boxes: (
  (
    at: 2,
    language: "rs",
  ),
  (
    at: 8,
    language: "c",
  ),
))
@Dherse Dherse added the enhancement New feature or request label Dec 9, 2024
@Dherse
Copy link
Owner

Dherse commented Dec 28, 2024

This may not be part of v1.2.0 but I am still thinking on how best to make this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants