@@ -13,6 +13,32 @@ 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
+ 'rust-sdk' : { repo : 'c2pa-rs' , path : '' , org : 'contentauth' } ,
39
+ trustmark : { repo : 'trustmark' , path : '' , org : 'adobe' } ,
40
+ } ;
41
+
16
42
/** @type {import('@docusaurus/types').Config } */
17
43
const config = {
18
44
title : 'Open-source tools for content authenticity and provenance' ,
@@ -49,6 +75,38 @@ const config = {
49
75
( {
50
76
docs : {
51
77
sidebarPath : require . resolve ( './sidebars.js' ) ,
78
+ editUrl : ( { docPath } ) => {
79
+ // Don't show edit link for dynamically generated API docs
80
+ if ( docPath . startsWith ( 'js-sdk/api/' ) ) {
81
+ return null ;
82
+ }
83
+
84
+ // Special case for supported-formats.md files
85
+ if ( docPath . endsWith ( 'supported-formats.md' ) ) {
86
+ return 'https://github.com/contentauth/c2pa-rs/edit/main/docs/supported-formats.md' ;
87
+ }
88
+
89
+ // Check if the doc is from an external repository
90
+ const externalRepo = Object . keys ( externalRepos ) . find ( ( repo ) =>
91
+ docPath . startsWith ( `${ repo } /` ) ,
92
+ ) ;
93
+
94
+ if ( externalRepo ) {
95
+ // Get the GitHub repository info for this external repo
96
+ const repoInfo = externalRepos [ externalRepo ] ;
97
+ // Remove the repo prefix from the path to get the relative path in the repo
98
+ let repoPath = docPath . replace ( `${ externalRepo } /` , '' ) ;
99
+ // Convert readme.md to README.md in the path
100
+ repoPath = repoPath . replace ( / r e a d m e \. m d $ / i, 'README.md' ) ;
101
+ return `https://github.com/${ repoInfo . org } /${ repoInfo . repo } /edit/main/${ repoInfo . path } ${ repoPath } ` ;
102
+ }
103
+
104
+ // Add edit link for main docs
105
+ let mainPath = docPath ;
106
+ // Convert readme.md to README.md in the path
107
+ mainPath = mainPath . replace ( / r e a d m e \. m d $ / i, 'README.md' ) ;
108
+ return `https://github.com/contentauth/opensource.contentauth.org/edit/main/docs/${ mainPath } ` ;
109
+ } ,
52
110
} ,
53
111
theme : {
54
112
customCss : require . resolve ( './src/css/custom.css' ) ,
@@ -92,7 +150,6 @@ const config = {
92
150
content : 'Open-source tools for content authenticity and provenance' ,
93
151
} ,
94
152
] ,
95
-
96
153
// Relative to your site's 'static' directory.
97
154
// Cannot be SVGs. Can be external URLs too.
98
155
colorMode : {
0 commit comments