Skip to content

Commit ccf738f

Browse files
committed
Fix anchor path
1 parent 527e8c1 commit ccf738f

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

build/package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ sh mithril/build.sh
3333
sh panzoom/build.sh
3434
sh prism/build.sh
3535
sh remark/build.sh
36-
sh themes/build.sh
36+
sh themes/build.sh $browser
3737

3838
# copy files
3939
mkdir -p tmp

build/themes/build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
browser=$1
4+
35
# set current working directory to directory of the shell script
46
cd "$(dirname "$0")"
57

@@ -49,4 +51,4 @@ npx csso --input cleanrmd/inst/resources/writ/writ.css --output ../../themes/wri
4951
# after
5052
rm -rf node_modules/ cleanrmd/
5153

52-
node fix-themes.js
54+
node fix-themes.js $browser

build/themes/fix-themes.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,22 @@ var fs = require('fs')
33
var path = require('path')
44
var themes = path.resolve(__dirname, '../../themes/')
55

6+
var prefix = {
7+
chrome: 'chrome',
8+
firefox: 'moz'
9+
}[process.argv[2] || 'chrome']
10+
611
fs.writeFileSync(
712
path.resolve(themes, 'github.css'),
813
fs.readFileSync(path.resolve(themes, 'github.css'), 'utf8')
9-
.replaceAll(/mask-image:url\(".*?"\)/g, 'mask-image:url("chrome-extension://__MSG_@@extension_id__/content/anchor.svg")'),
14+
.replaceAll(/mask-image:url\(".*?"\)/g, `mask-image:url("${prefix}-extension://__MSG_@@extension_id__/content/anchor.svg")`),
1015
'utf8'
1116
)
1217

1318
fs.writeFileSync(
1419
path.resolve(themes, 'github-dark.css'),
1520
fs.readFileSync(path.resolve(themes, 'github-dark.css'), 'utf8')
16-
.replaceAll(/mask-image:url\(".*?"\)/g, 'mask-image:url("chrome-extension://__MSG_@@extension_id__/content/anchor.svg")'),
21+
.replaceAll(/mask-image:url\(".*?"\)/g, `mask-image:url("${prefix}-extension://__MSG_@@extension_id__/content/anchor.svg")`),
1722
'utf8'
1823
)
1924

content/index.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,18 @@ body._toc-right { padding-right: 300px !important; }
259259
content: ' ';
260260
display: inline-block;
261261
background-color: currentColor;
262-
-webkit-mask-image: url("chrome-extension://__MSG_@@extension_id__/content/anchor.svg");
263262
mask-image: url("chrome-extension://__MSG_@@extension_id__/content/anchor.svg");
264263
}
264+
@supports (-moz-appearance: none) {
265+
.markdown-theme h1:hover .anchor .octicon-link:before,
266+
.markdown-theme h2:hover .anchor .octicon-link:before,
267+
.markdown-theme h3:hover .anchor .octicon-link:before,
268+
.markdown-theme h4:hover .anchor .octicon-link:before,
269+
.markdown-theme h5:hover .anchor .octicon-link:before,
270+
.markdown-theme h6:hover .anchor .octicon-link:before {
271+
mask-image: url("moz-extension://__MSG_@@extension_id__/content/anchor.svg");
272+
}
273+
}
265274

266275
.markdown-theme h1 .octicon-link,
267276
.markdown-theme h2 .octicon-link,

0 commit comments

Comments
 (0)