umberto 2.4.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/scripts/filter/after-post-render/fix-code-samples.js +12 -0
- package/scripts/utils/transforminfobox.js +12 -0
- package/src/data-converter/converters/typedoc/accessorparser.js +18 -1
- package/src/data-converter/converters/typedoc/methodparser.js +18 -1
- package/src/tasks/build-documentation.js +13 -2
- package/themes/umberto/layout/_partial/head.pug +2 -1
- package/themes/umberto/layout/api.pug +4 -0
- package/themes/umberto/layout/page.pug +4 -0
- package/themes/umberto/layout/sdk.pug +4 -0
- package/themes/umberto/src/css/_notice.scss +6 -0
- package/themes/umberto/src/css/_prism.scss +0 -5
- package/themes/umberto/src/css/helpers/_color.scss +2 -1
- package/themes/umberto/src/js/_attachpermalinklistener.js +38 -0
- package/themes/umberto/src/js/app.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "umberto",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "CKSource Documentation builder",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"webpack": "^5.74.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@ckeditor/ckeditor5-dev-bump-year": "^
|
|
60
|
-
"@ckeditor/ckeditor5-dev-ci": "^
|
|
61
|
-
"@ckeditor/ckeditor5-dev-docs": "^
|
|
62
|
-
"@ckeditor/ckeditor5-dev-release-tools": "^
|
|
59
|
+
"@ckeditor/ckeditor5-dev-bump-year": "^35.0.0",
|
|
60
|
+
"@ckeditor/ckeditor5-dev-ci": "^35.0.0",
|
|
61
|
+
"@ckeditor/ckeditor5-dev-docs": "^35.0.0",
|
|
62
|
+
"@ckeditor/ckeditor5-dev-release-tools": "^35.0.0",
|
|
63
63
|
"browser-sync": "^2.27.10",
|
|
64
64
|
"chai": "^4.3.6",
|
|
65
65
|
"chokidar": "^3.5.3",
|
|
@@ -7,10 +7,22 @@
|
|
|
7
7
|
|
|
8
8
|
const { default: cheerio } = require( 'cheerio' );
|
|
9
9
|
|
|
10
|
+
const regexp = /(?<=>)utf8_encoded_content:([0-9,]+)(?=<\/code><\/pre>)/g;
|
|
11
|
+
const textDecoder = new TextDecoder();
|
|
12
|
+
|
|
10
13
|
/**
|
|
11
14
|
* Fixes some codeblocks issues.
|
|
12
15
|
*/
|
|
13
16
|
hexo.extend.filter.register( 'after_post_render', page => {
|
|
17
|
+
// Decoding codeblocks inside infobox from UTF-8. See #1122.
|
|
18
|
+
if ( regexp.test( page.content ) ) {
|
|
19
|
+
page.content = page.content.replace( regexp, ( match, encodedContent ) => {
|
|
20
|
+
const decodedContent = textDecoder.decode( new Uint8Array( encodedContent.split( ',' ) ) );
|
|
21
|
+
|
|
22
|
+
return decodedContent.replace( /^\n/, '' );
|
|
23
|
+
} );
|
|
24
|
+
}
|
|
25
|
+
|
|
14
26
|
const $ = cheerio.load( page.content, null, false );
|
|
15
27
|
|
|
16
28
|
// This is an attempt to automatically discover code blocks of HTML and add 'html' class if needed.
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
const INFO_BOX_REGEXP = /<info-box[^>]*>([\s\S]*?)<\/info-box>/g;
|
|
9
9
|
const INFO_BOX_TYPE_REGEXP = /<info-box\s*(\w*)[^>]*>/;
|
|
10
|
+
const CODEBLOCK_REGEXP_STRING = /```(\S+)?(\n[\s\S]*?)```/g;
|
|
11
|
+
|
|
12
|
+
const textEncoder = new TextEncoder();
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* Replaces the `<info-box>` element with the HTML `div` element. E.g.:
|
|
@@ -61,6 +64,15 @@ function processInfobox( content, hexo ) {
|
|
|
61
64
|
content = content.replace( /^\n/, '' );
|
|
62
65
|
content = content.replace( /\n$/, '' );
|
|
63
66
|
|
|
67
|
+
// Encoding codeblocks inside infobox into UTF-8. See #1122.
|
|
68
|
+
content = content.replace( CODEBLOCK_REGEXP_STRING, ( match, language, content ) => {
|
|
69
|
+
const encodedContent = textEncoder.encode( content );
|
|
70
|
+
|
|
71
|
+
return language ?
|
|
72
|
+
`<pre class="highlight"><code class="${ language }">utf8_encoded_content:${ encodedContent }</code></pre>` :
|
|
73
|
+
`<pre class="highlight"><code>utf8_encoded_content:${ encodedContent }</code></pre>`;
|
|
74
|
+
} );
|
|
75
|
+
|
|
64
76
|
let markdownOutput = hexo.render.renderSync( { text: content, engine: 'markdown' } );
|
|
65
77
|
markdownOutput = markdownOutput.replace( /<\/p>\n/g, '</p>' );
|
|
66
78
|
markdownOutput = markdownOutput.replace( /\n<p>/g, '<p>' );
|
|
@@ -47,7 +47,7 @@ module.exports = class AccessorParser extends AbstractParser {
|
|
|
47
47
|
|
|
48
48
|
scope: this.getScope( item ),
|
|
49
49
|
readonly: this.isReadonly( item ),
|
|
50
|
-
access: this.
|
|
50
|
+
access: this.getVisibilityIncludingSignature( item ),
|
|
51
51
|
kind: this.getKind( item ),
|
|
52
52
|
extraId: this.getExtraId( item ),
|
|
53
53
|
description: this.getComment( getSignature || setSignature ),
|
|
@@ -61,4 +61,21 @@ module.exports = class AccessorParser extends AbstractParser {
|
|
|
61
61
|
params: null
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Returns the access type for the item based on its signatures.
|
|
67
|
+
*
|
|
68
|
+
* @param {TypedocReflection<Accessor>} item
|
|
69
|
+
* @returns {'public'|'internal'|'protected'|'private'}
|
|
70
|
+
*/
|
|
71
|
+
getVisibilityIncludingSignature( item ) {
|
|
72
|
+
if ( item.setSignature ) {
|
|
73
|
+
return this.getVisibility( item.setSignature );
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if ( item.getSignature ) {
|
|
77
|
+
return this.getVisibility( item.getSignature );
|
|
78
|
+
}
|
|
79
|
+
return this.getVisibility( item );
|
|
80
|
+
}
|
|
64
81
|
};
|
|
@@ -33,7 +33,7 @@ module.exports = class MethodParser extends AbstractParser {
|
|
|
33
33
|
|
|
34
34
|
scope: this.getScope( item ),
|
|
35
35
|
kind: this.getKind( item ),
|
|
36
|
-
access: this.
|
|
36
|
+
access: this.getVisibilityIncludingSignature( item, index ),
|
|
37
37
|
extraId: this.getExtraId( item ),
|
|
38
38
|
fires: this.getFiredEvents( signature, parentName ),
|
|
39
39
|
description: this.getComment( signature ),
|
|
@@ -60,4 +60,21 @@ module.exports = class MethodParser extends AbstractParser {
|
|
|
60
60
|
return doclet;
|
|
61
61
|
} );
|
|
62
62
|
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Returns the access type for the item based on its signatures.
|
|
66
|
+
*
|
|
67
|
+
* @param {TypedocReflection<ConstructorOrMethod>} item
|
|
68
|
+
* @param {Number} sourceIndex
|
|
69
|
+
* @returns {'public'|'internal'|'protected'|'private'}
|
|
70
|
+
*/
|
|
71
|
+
getVisibilityIncludingSignature( item, sourceIndex ) {
|
|
72
|
+
const signatureVisibility = this.getVisibility( item.signatures[ sourceIndex ] );
|
|
73
|
+
|
|
74
|
+
if ( signatureVisibility !== 'public' ) {
|
|
75
|
+
return signatureVisibility;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return this.getVisibility( item );
|
|
79
|
+
}
|
|
63
80
|
};
|
|
@@ -22,7 +22,7 @@ const cacheFiles = require( './cache-files' );
|
|
|
22
22
|
const overwriteApiGuides = require( './overwrite-api-guides' );
|
|
23
23
|
const cacheDir = upath.join( __dirname, '../../temp/cache' );
|
|
24
24
|
const validateLinks = require( './validate-links' );
|
|
25
|
-
const
|
|
25
|
+
const createSitemap = require( './create-sitemap' );
|
|
26
26
|
const buildSnippets = require( './build-snippets' );
|
|
27
27
|
const copyProjectIcons = require( './copy-project-icons' );
|
|
28
28
|
const executeHooks = require( './execute-hooks' );
|
|
@@ -269,7 +269,7 @@ module.exports = options => {
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
return
|
|
272
|
+
return createSitemap( 'build/docs', hostname, dst, {
|
|
273
273
|
excluded: excludedUrls,
|
|
274
274
|
extraUrlSettings
|
|
275
275
|
} );
|
|
@@ -339,6 +339,17 @@ function buildProjects( rootPath, projectPaths, options = {} ) {
|
|
|
339
339
|
skipGuides: options.skipGuides
|
|
340
340
|
} );
|
|
341
341
|
|
|
342
|
+
if ( !projectConfigs.length ) {
|
|
343
|
+
hexoManager.hexo.extend.filter.register( 'template_locals', locals => {
|
|
344
|
+
// Most probably this if is always true. Locals same for all projects.
|
|
345
|
+
if ( !locals.projectsData ) {
|
|
346
|
+
locals.projectsData = [];
|
|
347
|
+
}
|
|
348
|
+
locals.umbertoVersion = umbertoVersion;
|
|
349
|
+
locals.pathJoin = upath.join;
|
|
350
|
+
} );
|
|
351
|
+
}
|
|
352
|
+
|
|
342
353
|
projectConfigs.forEach( config => {
|
|
343
354
|
const basePath = upath.join( config.slug, config.version );
|
|
344
355
|
const extraStyles = getExtraFiles(
|
|
@@ -57,6 +57,7 @@ p.tip {
|
|
|
57
57
|
|
|
58
58
|
&__feedback {
|
|
59
59
|
border-left: 3px solid u-color( 'hint-hint' );
|
|
60
|
+
background-color: rgba( u-color( 'hint-hint' ), .1 );
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
&__warning {
|
|
@@ -64,6 +65,11 @@ p.tip {
|
|
|
64
65
|
background-color: rgba( u-color( 'hint-warning' ), .1 );
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
&__error {
|
|
69
|
+
border-left: 3px solid u-color( 'hint-error' );
|
|
70
|
+
background-color: rgba( u-color( 'hint-error' ), .1 );
|
|
71
|
+
}
|
|
72
|
+
|
|
67
73
|
&_menu-like {
|
|
68
74
|
ul, ol {
|
|
69
75
|
list-style: none;
|
|
@@ -125,11 +125,6 @@ div.code-toolbar {
|
|
|
125
125
|
position: relative;
|
|
126
126
|
|
|
127
127
|
& > .toolbar {
|
|
128
|
-
/* The toolbar does not look well on mobiles. There's not enough space. */
|
|
129
|
-
@include u-responsive-mobile {
|
|
130
|
-
display: none;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
128
|
position: absolute;
|
|
134
129
|
top: u-spacing( -2 );
|
|
135
130
|
right: u-spacing( -2 );
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2017-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const latestRegexp = /(?<=\/)latest(?=\/)/;
|
|
7
|
+
|
|
8
|
+
export default function attachPermalinkListener() {
|
|
9
|
+
const projectVersionElement = document.querySelector( 'meta[name=project-version]' );
|
|
10
|
+
|
|
11
|
+
if ( !projectVersionElement ) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const projectVersion = projectVersionElement.getAttribute( 'content' );
|
|
16
|
+
|
|
17
|
+
document.addEventListener( 'keypress', event => {
|
|
18
|
+
if ( event.metaKey ) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if ( event.shiftKey ) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if ( event.key.toUpperCase() !== 'Y' ) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if ( !latestRegexp.test( location.href ) ) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const newUrl = location.href.replace( latestRegexp, projectVersion );
|
|
35
|
+
|
|
36
|
+
history.replaceState( history.state, document.title, newUrl );
|
|
37
|
+
} );
|
|
38
|
+
}
|
|
@@ -26,6 +26,7 @@ import { rwdButton } from './_rwdmenu';
|
|
|
26
26
|
import imageModal from './_imageModal';
|
|
27
27
|
import showWarningBanner from './_warningbanner';
|
|
28
28
|
import { enableBadgeTooltips, createTooltip } from './_tooltips';
|
|
29
|
+
import attachPermalinkListener from './_attachpermalinklistener';
|
|
29
30
|
|
|
30
31
|
// Changing documentation theme. To enable, type in the console: `localStorage.setItem( 'theme', 'theme-dark' )`.
|
|
31
32
|
if ( localStorage.getItem( 'theme' ) === 'theme-dark' ) {
|
|
@@ -54,6 +55,7 @@ $( document ).ready( () => {
|
|
|
54
55
|
scrollApiTree();
|
|
55
56
|
setUpFuse();
|
|
56
57
|
activateDevNames();
|
|
58
|
+
attachPermalinkListener();
|
|
57
59
|
sideNavigation();
|
|
58
60
|
rwdButton();
|
|
59
61
|
imageModal(); // lightbox for { @img } elements
|