Skip to content

Commit 869fa54

Browse files
committed
feat: add copy page as markdown feature
1 parent 43ced99 commit 869fa54

File tree

14 files changed

+106
-17
lines changed

14 files changed

+106
-17
lines changed

docs/nimiq-css/utilities.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A set of CSS utility classes for the most common use cases.
44

5-
[Source code](https://github.com/onmax/nimiq-ui/tree/main/packages/nimiq-css/src/css/utilities.css){.nq-arrow .nq-pill-tertiary .nq-raw}
5+
<NqLinks :item="{ label: 'Source code', href: 'https://github.com/onmax/nimiq-ui/tree/main/packages/nimiq-css/src/css/utilities.css' }" />
66

77
## Usage in Native CSS
88

packages/nimiq-icons/src/flags/icons.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@
12681268
"body": "<mask id=\"nimiq-flags-zw-hexagon-pbk987\" width=\"32\" height=\"28\" x=\"0\" y=\"2\" maskUnits=\"userSpaceOnUse\" style=\"mask-type:alpha\"><path fill=\"#fff\" d=\"M31.15 14.71 24.707 3.54a2.58 2.58 0 00-2.234-1.29H9.582c-.92 0-1.77.49-2.23 1.29L.907 14.71c-.46.8-.46 1.78 0 2.58l6.445 11.17c.46.8 1.31 1.29 2.23 1.29h12.89c.92 0 1.77-.49 2.23-1.29l6.445-11.17c.464-.8.464-1.78.004-2.58\"/></mask><g fill=\"none\"><g mask=\"url(#nimiq-flags-zw-hexagon-pbk987)\"><path fill=\"#6DA544\" d=\"M1.962 0H32v32H1.962z\"/><path fill=\"#FFDA44\" d=\"M3.613 4.581H32v4.582l-4.069 6.875 4.07 6.875v4.58H3.612z\"/><path fill=\"#D80027\" d=\"M8.25 9.162H32v4.582l-1.687 2.25L32 18.325v4.581H8.25z\"/><path fill=\"#EEE\" d=\"M0 0v32l17.488-16z\"/><path fill=\"#D80027\" d=\"m6.437 11.825 1.032 3.188h3.35l-2.713 1.975 1.038 3.187-2.713-1.969-2.712 1.969 1.037-3.187-2.712-1.976h3.35z\"/><path fill=\"#FFDA44\" d=\"m9.281 16.263-2.7-.957-.212-1.937a1.044 1.044 0 10-2.032.475l-.75.756h1.344c0 1.4-1.044 1.4-1.044 2.794l.575 1.387h3.482l.58-1.387q.086-.198.107-.413c.5-.2.65-.719.65-.719\"/><path fill=\"#333\" d=\"m1.963 0 13.75 13.75H32v4.575H15.638L1.962 32H0l16-16L0 0z\"/><path fill=\"url(#nimiq-flags-zw-hexagon-pbk987)\" d=\"M31.15 14.71 24.707 3.54a2.58 2.58 0 00-2.234-1.29H9.582c-.92 0-1.77.49-2.23 1.29L.907 14.71c-.46.8-.46 1.78 0 2.58l6.445 11.17c.46.8 1.31 1.29 2.23 1.29h12.89c.92 0 1.77-.49 2.23-1.29l6.445-11.17c.464-.8.464-1.78.004-2.58\"/></g><defs><radialGradient id=\"nimiq-flags-zw-hexagon-pbk987\" cx=\"0\" cy=\"0\" r=\"1\" gradientTransform=\"matrix(30.943 0 0 30.9452 23.829 29.395)\" gradientUnits=\"userSpaceOnUse\"><stop stop-color=\"#1D1D1B\" stop-opacity=\".3\"/><stop offset=\"1\" stop-color=\"#E9B213\" stop-opacity=\"0\"/></radialGradient></defs></g>"
12691269
}
12701270
},
1271-
"lastModified": 1758697349,
1271+
"lastModified": 1759216589,
12721272
"width": 32,
12731273
"height": 32
12741274
}

packages/nimiq-icons/src/flags/info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"prefix": "nimiq-flags",
33
"name": "nimiq-flags",
44
"total": 422,
5-
"version": "1.0.0-beta.97",
5+
"version": "1.0.0-beta.100",
66
"author": {
77
"name": "onmax",
88
"url": "https://github.com/onmax"

packages/nimiq-icons/src/flags/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nimiq-flags",
33
"description": "The Nimiq Flags as an iconify icon set.",
44
"version": "1.0.0-beta.100",
5-
"iconSetVersion": "1.0.0-beta.97",
5+
"iconSetVersion": "1.0.0-beta.100",
66
"main": "index.js",
77
"module": "index.mjs",
88
"types": "index.d.ts",

packages/nimiq-icons/src/icons/icons.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,7 @@
15861586
"hidden": true
15871587
}
15881588
},
1589-
"lastModified": 1758697349,
1589+
"lastModified": 1759216589,
15901590
"width": 12,
15911591
"height": 12
15921592
}

packages/nimiq-icons/src/icons/info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"prefix": "nimiq",
33
"name": "nimiq-icons",
44
"total": 84,
5-
"version": "1.0.0-beta.97",
5+
"version": "1.0.0-beta.100",
66
"author": {
77
"name": "onmax",
88
"url": "https://github.com/onmax"

packages/nimiq-icons/src/icons/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nimiq-icons",
33
"description": "The Nimiq Icons as an iconify icon set.",
44
"version": "1.0.0-beta.100",
5-
"iconSetVersion": "1.0.0-beta.97",
5+
"iconSetVersion": "1.0.0-beta.100",
66
"main": "index.js",
77
"module": "index.mjs",
88
"types": "index.d.ts",

packages/nimiq-vitepress-theme/build.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export default defineBuildConfig({
5454
const srcDir = join(packageDir, 'src')
5555
const distFile = join(packageDir, 'dist/assets/uno.css')
5656
const config = join(packageDir, 'uno.config.ts')
57-
console.log({ config, srcDir, distFile })
5857
await execAsync(`unocss "${srcDir}/**/*.vue" -o "${distFile}" --config "${config}"`, { cwd: packageDir })
5958
},
6059
},

packages/nimiq-vitepress-theme/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@
7474
"@nolebase/vitepress-plugin-git-changelog": "catalog:build",
7575
"@vueuse/core": "catalog:utils",
7676
"@vueuse/motion": "^3.0.3",
77+
"fast-glob": "^3.3.3",
7778
"mark.js": "catalog:prod",
79+
"mdream": "^0.11.0",
7880
"minisearch": "catalog:prod",
7981
"motion-v": "^1.6.1",
8082
"nimiq-icons": "workspace:*",

packages/nimiq-vitepress-theme/src/composables/useSourceCode.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,16 @@ export function useSourceCode() {
107107

108108
const copyMarkdownContent = async () => {
109109
try {
110-
let rawUrl = sourceCodeUrl.value
111-
112-
if (rawUrl.includes('github.com') && rawUrl.includes('/blob/')) {
113-
rawUrl = rawUrl
114-
.replace('github.com', 'raw.githubusercontent.com')
115-
.replace('/blob/', '/')
110+
if (typeof window === 'undefined') {
111+
toast.error('Copy functionality not available during server-side rendering')
112+
return
116113
}
117114

118-
const response = await fetch(rawUrl)
115+
const currentPath = window.location.pathname
116+
const markdownPath = currentPath.replace(/\.html$/, '.md').replace(/\/$/, '/index.md')
117+
const markdownUrl = `${window.location.origin}${markdownPath}`
118+
119+
const response = await fetch(markdownUrl)
119120
if (!response.ok) {
120121
throw new Error(`HTTP ${response.status}: ${response.statusText}`)
121122
}
@@ -126,7 +127,6 @@ export function useSourceCode() {
126127
}
127128
catch (error) {
128129
console.error('Failed to copy markdown content:', error)
129-
console.error('Source URL was:', sourceCodeUrl.value)
130130
toast.error('Failed to copy page content')
131131
}
132132
}

0 commit comments

Comments
 (0)