diff --git a/docs/latest/api/base-window.md b/docs/latest/api/base-window.md index d84a4d832..ed2e78554 100644 --- a/docs/latest/api/base-window.md +++ b/docs/latest/api/base-window.md @@ -73,8 +73,8 @@ const child = new BaseWindow({ parent, modal: true }) ## Resource management -When you add a [`WebContentsView`](latest/api/web-contents-view.md) to a `BaseWindow` and the `BaseWindow` -is closed, the [`webContents`](latest/api/web-contents.md) of the `WebContentsView` are not destroyed +When you add a [`WebContentsView`](web-contents-view.md) to a `BaseWindow` and the `BaseWindow` +is closed, the [`webContents`](web-contents.md) of the `WebContentsView` are not destroyed automatically. It is your responsibility to close the `webContents` when you no longer need them, e.g. when @@ -93,7 +93,7 @@ win.on('closed', () => { }) ``` -Unlike with a [`BrowserWindow`](latest/api/browser-window.md), if you don't explicitly close the +Unlike with a [`BrowserWindow`](browser-window.md), if you don't explicitly close the `webContents`, you'll encounter memory leaks. ## Class: BaseWindow diff --git a/docs/latest/api/menu.md b/docs/latest/api/menu.md index 77b203527..db97be7c3 100644 --- a/docs/latest/api/menu.md +++ b/docs/latest/api/menu.md @@ -97,7 +97,7 @@ Pops up this menu as a context menu in the [`BaseWindow`](base-window.md). #### `menu.closePopup([window])` -* `browserWindow` [BaseWindow](base-window.md) (optional) - Default is the focused window. +* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window. Closes the context menu in the `window`. diff --git a/docs/latest/api/session.md b/docs/latest/api/session.md index 59235a048..c19baa2bf 100644 --- a/docs/latest/api/session.md +++ b/docs/latest/api/session.md @@ -35,7 +35,7 @@ The `session` module has the following methods: * `partition` string * `options` Object (optional) * `cache` boolean - Whether to enable cache. Default is `true` unless the - [`--disable-http-cache` switch](latest/api/command-line-switches.md#--disable-http-cache) is used. + [`--disable-http-cache` switch](command-line-switches.md#--disable-http-cache) is used. Returns `Session` - A session instance from `partition` string. When there is an existing `Session` with the same `partition`, it will be returned; otherwise a new @@ -55,7 +55,7 @@ of an existing `Session` object. * `path` string * `options` Object (optional) * `cache` boolean - Whether to enable cache. Default is `true` unless the - [`--disable-http-cache` switch](latest/api/command-line-switches.md#--disable-http-cache) is used. + [`--disable-http-cache` switch](command-line-switches.md#--disable-http-cache) is used. Returns `Session` - A session instance from the absolute path as specified by the `path` string. When there is an existing `Session` with the same absolute path, it diff --git a/scripts/process-posts.ts b/scripts/process-posts.ts deleted file mode 100644 index e6dc3764f..000000000 --- a/scripts/process-posts.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Transforms the original markdown of the posts in electron/electronjs.org - * into something that can be consumed by Docusaurus. - * - * This should not happen very frequently as we want to move the blog content - * to this repo, but until that happens this file should remain here. - */ -import fs from 'node:fs/promises'; -import path from 'node:path'; - -import globby from 'globby'; -import frontmatter from 'gray-matter'; - -const createAuthor = (author: string) => { - return { - name: author, - url: `https://github.com/${author}`, - image_url: `https://github.com/${author}.png?size=96`, - }; -}; - -const start = async () => { - const postsPaths = await globby(['blog/*.md']); - - const imgRegex = //gm; - - for (const postPath of postsPaths) { - const post = await fs.readFile(postPath, 'utf-8'); - const info = frontmatter(post); - - // Docusaurus multiple authors format is different: https://docusaurus.io/docs/blog#blog-post-authors - if (info.data.author) { - info.data.authors = Array.isArray(info.data.author) - ? info.data.author.map(createAuthor) - : createAuthor(info.data.author); - - delete info.data.author; - } - info.content = info.content - .replace(imgRegex, ``) - .replace(/
/gm, '
') - .replace(/\/\/>/gm, '/>'); - - info.data.slug = path.basename(postPath).replace('.md', ''); - info.data.date = new Date(info.data.date); - - const content = frontmatter.stringify(info.content.trim(), info.data); - - await fs.writeFile(postPath, content, 'utf-8'); - } -}; - -start(); diff --git a/scripts/tasks/md-fixers.ts b/scripts/tasks/md-fixers.ts index c0c79a1e6..543d2d3b5 100644 --- a/scripts/tasks/md-fixers.ts +++ b/scripts/tasks/md-fixers.ts @@ -3,31 +3,12 @@ import path from 'node:path'; import globby from 'globby'; -/** - * RegExp use to match the old markdown format for fiddle - * in `fiddleTransformer`. - */ -const fiddleRegex = /^```javascript fiddle='docs\/(\S+)?'$/; const fiddlePathFixRegex = /```fiddle docs\//; -/** - * Updates the markdown fiddle format from: - * ``` - * ```javascript fiddle='docs/fiddles/screen/fit-screen' - * ``` - * To - * ``` - * ```fiddle docs/latest/fiddles/example - * ``` - * @param line - */ const fiddleTransformer = (line: string) => { - const matches = fiddleRegex.exec(line); const hasNewPath = fiddlePathFixRegex.test(line); - if (matches) { - return `\`\`\`fiddle docs/latest/${matches[1]}`; - } else if (hasNewPath) { + if (hasNewPath) { return ( line .replace(fiddlePathFixRegex, '```fiddle docs/latest/') @@ -145,16 +126,6 @@ export const fixContent = async (root: string, version = 'latest') => { cwd: root, }); - /** - * Filenames in Electron docs are usually unique so best effort - * consist on using the filename (basename) to identify the right - * place where it should point. - */ - const linksMaps = new Map(); - for (const filePath of files) { - linksMaps.set(path.basename(filePath), filePath); - } - for (const filePath of files) { const fullFilePath = path.join(root, filePath); const content = await fs.readFile(fullFilePath, 'utf-8');