-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add copy button for code blocks on MD files. #118
Add copy button for code blocks on MD files. #118
Conversation
Astro docs example https://docs.astro.build/en/guides/markdown-content/ |
Seems like a great idea to me! It might be more pain to implement in Get Started command blocks since you’d only want to copy a command and not the entire block content in every case—like when there’s pretend terminal output shown. |
Yeah, the get started will need more work. |
Is there a way to use this without changing the style of the code blocks? Using this post as a reference, it seems like it changes the theme, font face and spacing, adds some kind of tab bar sometimes, and adds borders (most visible in dark mode) with a different drop shadow: |
@@ -39,11 +54,7 @@ export default defineConfig({ | |||
prefetch(), | |||
], | |||
markdown: { | |||
syntaxHighlight: "shiki", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this because that plugin already uses shiki.
// https://github.com/shikijs/shiki/blob/main/docs/languages.md | ||
shikiConfig: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It did not seem like its needed anymore since it was specified above.
Now that you have privileges to do so, please try to remember to create your branch on ddev/ddev.com so the actual build happens on the PR, making it easier to review. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Result seems fantastic to me, thanks!
@rfay I tried adding my branch on ddev/ddev.com but it did not let me. It asked me for my GitHub password but then it told me passwords are disabled. I will try again with the next branch but I did wonder if maybe I'm missing something or is a user error. |
Yeah, you can't use passwords with github any more at all. Assuming your remote named
Then:
|
Awesome, thanks for the detail instructions. I thought I did that and it still did not let me but I will try again and report back. |
I have that but then when I do
I get - Username for 'https://github.com': and I can merge PRs fine from the UI, but the permission for my user to push branches to the repo might be missing something. My ssh key works well with my own and other repos so that's odd too. |
Do you have an ssh key registered with github? Is git using it? |
Oh, you're using https, don't do that. |
Closing this branch as PR #121 is the same but with a preview. |
The Issue
Currently, blog posts don't have a copy button snippets of code. The DDev docs do but not ddev.com
How This PR Solves The Issue
Astro uses the astro-expressive-code plugin which provides that functionality.
https://github.com/expressive-code/expressive-code/blob/main/packages/astro-expressive-code/README.md
The image below is taken from this blog
https://ddev.com/blog/amd64-on-apple-silicon-ddev/