@@ -13,6 +13,33 @@ const copyright = `
13
13
</div>
14
14
` ;
15
15
16
+ // Map of external repositories to their GitHub repository names, paths, and organizations
17
+ const externalRepos = {
18
+ 'c2pa-c' : { repo : 'c2pa-c' , path : '' , org : 'contentauth' } ,
19
+ 'c2pa-min' : { repo : 'c2pa-min' , path : '' , org : 'contentauth' } ,
20
+ 'c2pa-node' : { repo : 'c2pa-node' , path : '' , org : 'contentauth' } ,
21
+ 'c2pa-node-example' : {
22
+ repo : 'c2pa-node-example' ,
23
+ path : '' ,
24
+ org : 'contentauth' ,
25
+ } ,
26
+ 'c2pa-python' : { repo : 'c2pa-python' , path : '' , org : 'contentauth' } ,
27
+ 'c2pa-python-example' : {
28
+ repo : 'c2pa-python-example' ,
29
+ path : '' ,
30
+ org : 'contentauth' ,
31
+ } ,
32
+ 'c2pa-service-example' : {
33
+ repo : 'c2pa-service-example' ,
34
+ path : '' ,
35
+ org : 'contentauth' ,
36
+ } ,
37
+ c2patool : { repo : 'c2pa-rs' , path : 'cli/' , org : 'contentauth' } ,
38
+ 'js-sdk' : { repo : 'c2pa-js' , path : '' , org : 'contentauth' } ,
39
+ 'rust-sdk' : { repo : 'c2pa-rs' , path : '' , org : 'contentauth' } ,
40
+ trustmark : { repo : 'trustmark' , path : '' , org : 'adobe' } ,
41
+ } ;
42
+
16
43
/** @type {import('@docusaurus/types').Config } */
17
44
const config = {
18
45
title : 'Open-source tools for content authenticity and provenance' ,
@@ -49,6 +76,33 @@ const config = {
49
76
( {
50
77
docs : {
51
78
sidebarPath : require . resolve ( './sidebars.js' ) ,
79
+ editUrl : ( { docPath } ) => {
80
+ // Special case for supported-formats.md files
81
+ if ( docPath . endsWith ( 'supported-formats.md' ) ) {
82
+ return 'https://github.com/contentauth/c2pa-rs/edit/main/docs/supported-formats.md' ;
83
+ }
84
+
85
+ // Check if the doc is from an external repository
86
+ const externalRepo = Object . keys ( externalRepos ) . find ( ( repo ) =>
87
+ docPath . startsWith ( `${ repo } /` ) ,
88
+ ) ;
89
+
90
+ if ( externalRepo ) {
91
+ // Get the GitHub repository info for this external repo
92
+ const repoInfo = externalRepos [ externalRepo ] ;
93
+ // Remove the repo prefix from the path to get the relative path in the repo
94
+ let repoPath = docPath . replace ( `${ externalRepo } /` , '' ) ;
95
+ // Convert readme.md to README.md in the path
96
+ repoPath = repoPath . replace ( / r e a d m e \. m d $ / i, 'README.md' ) ;
97
+ return `https://github.com/${ repoInfo . org } /${ repoInfo . repo } /edit/main/${ repoInfo . path } ${ repoPath } ` ;
98
+ }
99
+
100
+ // Add edit link for main docs
101
+ let mainPath = docPath ;
102
+ // Convert readme.md to README.md in the path
103
+ mainPath = mainPath . replace ( / r e a d m e \. m d $ / i, 'README.md' ) ;
104
+ return `https://github.com/contentauth/opensource.contentauth.org/edit/main/docs/${ mainPath } ` ;
105
+ } ,
52
106
} ,
53
107
theme : {
54
108
customCss : require . resolve ( './src/css/custom.css' ) ,
@@ -92,7 +146,6 @@ const config = {
92
146
content : 'Open-source tools for content authenticity and provenance' ,
93
147
} ,
94
148
] ,
95
-
96
149
// Relative to your site's 'static' directory.
97
150
// Cannot be SVGs. Can be external URLs too.
98
151
colorMode : {
0 commit comments