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

feat: add code-group component #1560

Merged
merged 6 commits into from
Dec 16, 2022
Merged

feat: add code-group component #1560

merged 6 commits into from
Dec 16, 2022

Conversation

brc-dd
Copy link
Member

@brc-dd brc-dd commented Oct 30, 2022

fixes #728
closes #1242

Huge thanks to @VoVAllen!

TODO:

brc-dd and others added 2 commits October 31, 2022 00:59
Co-authored-by: "Jinjing.Zhou" <allenzhou@tensorchord.ai>
@VoVAllen
Copy link
Contributor

image
The width of header looks a bit weird

@brc-dd
Copy link
Member Author

brc-dd commented Oct 31, 2022

I've actually took most of the UI from what we have in @vue/theme (vuejs/theme#50, a demo is here).

/cc @kiaking Your inputs? Should we change the UI?

@kiaking
Copy link
Member

kiaking commented Oct 31, 2022

@brc-dd yeah I'll take this one over! I would like to adjust a just bit on tabs 👀 I'll work this on today or tomorrow 👍

@kiaking kiaking self-assigned this Oct 31, 2022
@jd-solanki
Copy link
Contributor

My thoughts on UI: #728 (comment)

@brc-dd brc-dd changed the title feat: add code-groups component feat: add code-group component Oct 31, 2022
@mancuoj
Copy link
Contributor

mancuoj commented Dec 1, 2022

Wow! Will this feature appear in the next release? So I don't have to use the garbage code I wrote 👀

@kiaking
Copy link
Member

kiaking commented Dec 1, 2022

Hopefully! Sorry it's taking time but I will work on it.

@kiaking
Copy link
Member

kiaking commented Dec 15, 2022

OK finally! I've modified the style to be:

Screenshot 2022-12-16 at 0 10 37

Screenshot 2022-12-16 at 0 10 30

@jd-solanki
Copy link
Contributor

I love this style 😍

@kiaking kiaking merged commit a684b67 into main Dec 16, 2022
@kiaking kiaking deleted the codegroups-js branch December 16, 2022 01:12
@MarkusKeck
Copy link
Collaborator

This would completely replace the need of markdown-it-codetabs which I currently use in all my vitepress projects.
Big thumbs up!

@MarkusKeck
Copy link
Collaborator

How can I import code snippets into codeblocks?
I just tested the newly added codeblock, but I cannot add code snippets like it is possible with single code blocks.
Can this functionality please be added into codeblocks as well, if it is not currently possible?
Codeblocks hold way more code than single code components which results in a very messy markdown if imports are not possible

@VoVAllen
Copy link
Contributor

Glad to see this feature got merged!

@dmoyadev
Copy link

I have the same problem with this feature as @MarkusKeck, code snippets are not working and I think it is a core feature with large code blocks or change-prone ones, is there a workaround or something to have them working? Thanks in advance!

@MarkusKeck
Copy link
Collaborator

MarkusKeck commented Jan 11, 2023

@dmoyadev I use the @include statement and have all other markup inside the code itself.
Not pretty but the best solution I came up with.
I hope this will be supported at one point. This would allow for a clean code snippet file.

::: code-group

<!--@include: ./../../../snippets/BubbleSort.java-->

:::

The code fle itself (changed the ` to ' so it gets displayed correctly)

'''java [BubbleSort.java]
package net.bitelligence.exercise.sorting;

public class BubbleSort {

    public int[] bubbleSort(int[] numbers) {

    }

}
'''

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support code groups and allow adding title to code blocks
7 participants