Skip to content

Commit f12c503

Browse files
committed
Add back apidocs.css and linking fixes
1 parent 908e1bb commit f12c503

File tree

7 files changed

+22
-28
lines changed

7 files changed

+22
-28
lines changed

internal/documentation/.vitepress/theme/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { onMounted, watch, nextTick } from "vue";
55

66
// custom css
77
import "./custom.css";
8+
import "./apidocs.css";
89

910
// global components
1011
import Badgen from "@theme/components/Badgen.vue";
@@ -25,7 +26,7 @@ export default {
2526
},
2627

2728
setup() {
28-
// this function will be executed inside VitePressApp's setup hook.
29+
// this function will be executed inside VitePressApp's setup hook.
2930
// all composition APIs are available here.
3031
const route = useRoute();
3132
let initZoom: () => void;

internal/documentation/jsdoc/docdash/publish.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,11 @@ function linkTo(longname, linkText, cssClass, fragmentId) {
625625
if (fileUrl && githubSourceBaseUrl && (fileUrl.endsWith('.js.md') || longname.endsWith('.js'))) {
626626
fileUrl = convertSourceLinkToGitHub(fileUrl, longname);
627627
}
628+
// Remove .md extension from internal links for VitePress compatibility
629+
// Handle both cases: with and without fragment identifiers
630+
else if (fileUrl) {
631+
fileUrl = fileUrl.replace(/\.md(#|$)/, '$1');
632+
}
628633
}
629634

630635
text = text || longname;
@@ -679,8 +684,10 @@ function linkComplexType(longname, linkText, cssClass) {
679684
if (/^.+\|.+$/.test(longname) && !/<.+>/.test(longname)) {
680685
const types = longname.split('|').map(t => t.trim());
681686
return types.map(type => {
682-
const url = helper.longnameToUrl[type];
687+
let url = helper.longnameToUrl[type];
683688
if (url) {
689+
// Remove .md extension for VitePress compatibility
690+
url = url.replace(/\.md$/, '');
684691
return util.format('<a href="%s"%s>%s</a>', encodeURI(url), classString, htmlsafe(type));
685692
}
686693
return htmlsafe(type);
@@ -714,8 +721,10 @@ function linkGenericType(type, classString) {
714721

715722
// Link the base type if it has a URL
716723
let result = '';
717-
const baseUrl = helper.longnameToUrl[baseType];
724+
let baseUrl = helper.longnameToUrl[baseType];
718725
if (baseUrl) {
726+
// Remove .md extension for VitePress compatibility
727+
baseUrl = baseUrl.replace(/\.md$/, '');
719728
result = util.format('<a href="%s"%s>%s</a>', encodeURI(baseUrl), classString, htmlsafe(baseType));
720729
} else {
721730
result = htmlsafe(baseType);
@@ -727,8 +736,10 @@ function linkGenericType(type, classString) {
727736
if (isComplexTypeExpression(innerType)) {
728737
result += linkComplexType(innerType, null, classString.replace(' class="', '').replace('"', ''));
729738
} else {
730-
const innerUrl = helper.longnameToUrl[innerType];
739+
let innerUrl = helper.longnameToUrl[innerType];
731740
if (innerUrl) {
741+
// Remove .md extension for VitePress compatibility
742+
innerUrl = innerUrl.replace(/\.md$/, '');
732743
result += util.format('<a href="%s"%s>%s</a>', encodeURI(innerUrl), classString, htmlsafe(innerType));
733744
} else {
734745
result += htmlsafe(innerType);

internal/documentation/jsdoc/docdash/tmpl/params.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@
6363
var self = this;
6464
params.forEach(function(param) {
6565
if (!param) { return; }
66-
?>| <?js if (params.hasName) {?>`<?js= param.name ?>` | <?js } ?><?js if (param.type && param.type.names) {?><?js= self.partial('type.tmpl', param.type.names) ?><?js } ?> | <?js if (params.hasAttributes) {?><?js if (param.optional) { ?>optional<?js } ?><?js if (param.nullable) { ?><?js if (param.optional) { ?>, <?js } ?>nullable<?js } ?><?js if (param.variable) { ?><?js if (param.optional || param.nullable) { ?>, <?js } ?>repeatable<?js } ?> | <?js } ?><?js if (params.hasDefault) {?><?js if (typeof param.defaultvalue !== 'undefined') { ?>`<?js= self.htmlsafe(param.defaultvalue) ?>`<?js } ?> | <?js } ?><?js if(param.description !== undefined) { ?><?js= param.description.replaceAll('\n', '<br>') ?><?js } ?><?js if (param.subparams) { ?><br>*Properties:*<?js= self.partial('properties.tmpl', param.subparams).replace("\n", "") ?><?js } ?>
66+
?>| <?js if (params.hasName) {?>`<?js= param.name ?>` | <?js } ?><?js if (param.type && param.type.names) {?><?js= self.partial('type.tmpl', param.type.names) ?><?js } ?> | <?js if (params.hasAttributes) {?><?js if (param.optional) { ?>optional<?js } ?><?js if (param.nullable) { ?><?js if (param.optional) { ?>, <?js } ?>nullable<?js } ?><?js if (param.variable) { ?><?js if (param.optional || param.nullable) { ?>, <?js } ?>repeatable<?js } ?> | <?js } ?><?js if (params.hasDefault) {?><?js if (typeof param.defaultvalue !== 'undefined') { ?>`<?js= self.htmlsafe(param.defaultvalue) ?>`<?js} ?> | <?js } ?><?js if(param.description !== undefined) { ?><?js= param.description.replaceAll('\n', '<br>') ?><?js } ?><?js if (param.subparams) { ?><br>*Properties:*<?js= self.partial('properties.tmpl', param.subparams).replace("\n", "").replaceAll("|", "&#124;") ?><?js } ?>
6767
<?js }); ?>

internal/documentation/jsdoc/docdash/tmpl/properties.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@
3636
props.hasDefault = true;
3737
}
3838
});
39-
?><table class="props"><thead><tr><?js if (props.hasName) {?><th>Name</th><?js } ?><th>Type</th><?js if (props.hasAttributes) {?><th>Attributes</th><?js } ?><?js if (props.hasDefault) {?><th>Default</th><?js } ?><th class="last">Description</th></tr></thead><tbody><?js var self = this; props.forEach(function(prop) { if (!prop) { return; } ?><tr><?js if (props.hasName) {?><td class="name"><code><?js= prop.name ?></code></td><?js } ?><td class="type"><?js if (prop.type && prop.type.names) {?><?js= self.partial('type.tmpl', prop.type.names) ?><?js } ?></td><?js if (props.hasAttributes) {?><td class="attributes"><?js if (prop.optional) { ?>optional<?js } ?><?js if (prop.nullable) { ?>nullable<?js } ?></td><?js } ?><?js if (props.hasDefault) {?><td class="default"><?js if (typeof prop.defaultvalue !== 'undefined') { ?><code><?js= self.htmlsafe(prop.defaultvalue) ?></code><?js } ?></td><?js } ?><td class="description last"><?js= prop.description?.replaceAll("\n", "<br>") ?><?js if (prop.subprops) { ?><h6>Properties</h6><?js= self.partial('properties.tmpl', prop).replace("\n", "") ?><?js } ?></td></tr><?js }); ?></tbody></table>
39+
?><table class="props"><thead><tr><?js if (props.hasName) {?><th>Name</th><?js } ?><th>Type</th><?js if (props.hasAttributes) {?><th>Attributes</th><?js } ?><?js if (props.hasDefault) {?><th>Default</th><?js } ?><th class="last">Description</th></tr></thead><tbody><?js var self = this; props.forEach(function(prop) { if (!prop) { return; } ?><tr><?js if (props.hasName) {?><td class="name"><code><?js= prop.name ?></code></td><?js } ?><td class="type"><?js if (prop.type && prop.type.names) {?><?js= self.partial('type.tmpl', prop.type.names) ?><?js } ?></td><?js if (props.hasAttributes) {?><td class="attributes"><?js if (prop.optional) { ?>optional<?js } ?><?js if (prop.nullable) { ?>nullable<?js } ?></td><?js } ?><?js if (props.hasDefault) {?><td class="default"><?js if (typeof prop.defaultvalue !== 'undefined') { ?><code><?js= self.htmlsafe(prop.defaultvalue) ?></code><?js } ?></td><?js } ?><td class="description last"><?js= prop.description?.replaceAll("\n", "<br>") ?><?js if (prop.subprops) { ?><h6>Properties</h6><?js= self.partial('properties.tmpl', prop).replace("\n", "").replaceAll("|", "&#124;") ?><?js } ?></td></tr><?js }); ?></tbody></table>

internal/documentation/jsdoc/jsdoc-workspace.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@
2727
"cleverLinks": false,
2828
"monospaceLinks": false,
2929
"default": {
30-
"useLongnameInNav": true,
31-
"staticFiles": {
32-
"include": ["jsdoc/templates/custom.css"]
33-
}
30+
"useLongnameInNav": true
3431
}
3532
},
3633
"openGraph": {

internal/documentation/jsdoc/jsdoc.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@
2626
"cleverLinks": false,
2727
"monospaceLinks": false,
2828
"default": {
29-
"useLongnameInNav": true,
30-
"staticFiles": {
31-
"include": ["jsdoc/templates/custom.css"]
32-
}
29+
"useLongnameInNav": true
3330
}
3431
},
3532
"openGraph": {
@@ -64,6 +61,7 @@
6461
"class": "menu-item",
6562
"id": "github_link"
6663
}
67-
}
64+
},
65+
"githubSourceBaseUrl": "https://github.com/UI5/cli/blob/main"
6866
}
6967
}

internal/documentation/jsdoc/templates/custom.css

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)