File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 2626 run : npm run docs:build
2727 env :
2828 VP_DOMAIN : https://documentation.apeirora.eu/
29+ VP_EDIT_LINK_PATTERN : ' https://github.com/apeirora/documentation/edit/main/:path'
2930
3031 - name : Upload Build Artifact
3132 uses : actions/upload-pages-artifact@v3
Original file line number Diff line number Diff line change @@ -24,6 +24,22 @@ const resolveAbsoluteUrl = (relativeUrl: string) => {
2424}
2525const NAV_BAR_DIVIDER = { text : '' , link : '#--divider--' , activeMatch : '' }
2626
27+ const EDIT_LINK_PATTERN = process . env . VP_EDIT_LINK_PATTERN
28+ if ( EDIT_LINK_PATTERN ) {
29+ try {
30+ const url = new URL ( EDIT_LINK_PATTERN )
31+ const urlStr = url . toString ( )
32+ if ( ! urlStr . includes ( '/:path' ) ) {
33+ throw new Error ( `Edit link pattern '${ EDIT_LINK_PATTERN } ' must contain the placeholder '/:path', check environment variable VP_EDIT_LINK_PATTERN` )
34+ }
35+ } catch ( err ) {
36+ throw new Error ( `Edit link pattern '${ EDIT_LINK_PATTERN } ' must be a valid URL, check environment variable VP_EDIT_LINK_PATTERN` , err )
37+ }
38+ }
39+ const editLinkConfig = EDIT_LINK_PATTERN
40+ ? { editLink : { pattern : EDIT_LINK_PATTERN } }
41+ : { }
42+
2743// https://vitepress.dev/reference/site-config
2844export default withMermaid ( defineConfig ( {
2945 title : "ApeiroRA" ,
@@ -64,6 +80,7 @@ export default withMermaid(defineConfig({
6480 socialLinks : [
6581 { icon : 'github' , link : 'https://github.com/apeirora/' }
6682 ] ,
83+ ...editLinkConfig ,
6784
6885 logo : {
6986 // relative to `public` folder
You can’t perform that action at this time.
0 commit comments