Skip to content

Commit 3922063

Browse files
feat: copy button on blog pages and getting started pages (#487)
Co-authored-by: Stanislav Zhuk <[email protected]>
1 parent 7d77061 commit 3922063

File tree

5 files changed

+249
-71
lines changed

5 files changed

+249
-71
lines changed

astro.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import searchIndex from "./src/lib/search-index.js"
1010
import sitemap from "@astrojs/sitemap"
1111
import tailwindcss from "@tailwindcss/vite"
1212
import widont from "rehype-widont"
13+
import { addCopyButton } from "shiki-transformer-copy-button"
1314

1415
// https://astro.build/config
1516
export default defineConfig({
@@ -51,6 +52,14 @@ export default defineConfig({
5152
// https://github.com/shikijs/shiki/blob/main/docs/languages.md
5253
shikiConfig: {
5354
theme: "nord",
55+
// You can add options to the transformer here
56+
// For example, to change the 'copied' state duration:
57+
// toggle: 3000, // 3 seconds
58+
transformers: [
59+
addCopyButton({
60+
// visibility: 'hover', // if you want it to only show on hover
61+
}),
62+
],
5463
},
5564
remarkPlugins: [remarkReadingTime],
5665
rehypePlugins: [

package-lock.json

Lines changed: 60 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@tailwindcss/vite": "^4.0.3",
2727
"@types/react": "^18.2.23",
2828
"@types/react-dom": "^18.2.8",
29-
"astro": "^5.16.3",
29+
"astro": "^5.16.5",
3030
"astro-rehype-relative-markdown-links": "^0.17.3",
3131
"astro-robots-txt": "^1.0.0",
3232
"astro-seo": "^0.8.0",
@@ -54,6 +54,7 @@
5454
"@types/marked": "^4.0.8",
5555
"dotenv": "^16.3.1",
5656
"prettier": "^3.6.2",
57+
"shiki-transformer-copy-button": "^0.0.5",
5758
"textlint": "^15.1.0",
5859
"textlint-filter-rule-comments": "^1.2.2",
5960
"textlint-rule-no-todo": "^2.0.1",

0 commit comments

Comments
 (0)