mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
feat(docs): improve link validation (#5394)
This commit is contained in:
parent
78ab2955f3
commit
c12374ea07
@ -1488,7 +1488,7 @@ User can inspect selectors or perform manual steps while paused. Resume will con
|
||||
the place it was paused.
|
||||
|
||||
:::note
|
||||
This method requires Playwright to be started in a headed mode, with a falsy [`options: headless`] value in
|
||||
This method requires Playwright to be started in a headed mode, with a falsy [`option: headless`] value in
|
||||
the [`method: BrowserType.launch`].
|
||||
:::
|
||||
|
||||
|
||||
2
types/types.d.ts
vendored
2
types/types.d.ts
vendored
@ -2089,7 +2089,7 @@ export interface Page {
|
||||
* User can inspect selectors or perform manual steps while paused. Resume will continue running the original script from
|
||||
* the place it was paused.
|
||||
*
|
||||
* > NOTE: This method requires Playwright to be started in a headed mode, with a falsy [`options: headless`] value in the
|
||||
* > NOTE: This method requires Playwright to be started in a headed mode, with a falsy `headless` value in the
|
||||
* [browserType.launch([options])](https://playwright.dev/docs/api/class-browsertype#browsertypelaunchoptions).
|
||||
*/
|
||||
pause(): Promise<void>;
|
||||
|
||||
@ -49,7 +49,7 @@ const md = require('../markdown');
|
||||
* option?: string
|
||||
* }): string} Renderer
|
||||
*/
|
||||
|
||||
|
||||
class Documentation {
|
||||
/**
|
||||
* @param {!Array<!Documentation.Class>} classesArray
|
||||
@ -254,7 +254,7 @@ Documentation.Class = class {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {function(Documentation.Member|Documentation.Class): void} visitor
|
||||
*/
|
||||
visit(visitor) {
|
||||
@ -383,7 +383,7 @@ Documentation.Member = class {
|
||||
return new Documentation.Member('event', langs, name, type, [], spec);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param {function(Documentation.Member|Documentation.Class): void} visitor
|
||||
*/
|
||||
visit(visitor) {
|
||||
@ -637,13 +637,14 @@ function patchLinks(classOrMember, spec, classesMap, membersMap, linkRenderer) {
|
||||
md.visitAll(spec, node => {
|
||||
if (!node.text)
|
||||
return;
|
||||
node.text = node.text.replace(/\[`((?:event|method|property): [^\]]+)`\]/g, (match, p1) => {
|
||||
const member = membersMap.get(p1);
|
||||
if (!member)
|
||||
throw new Error('Undefined member references: ' + match);
|
||||
return linkRenderer({ member }) || match;
|
||||
});
|
||||
node.text = node.text.replace(/\[`(param|option): ([^\]]+)`\]/g, (match, p1, p2) => {
|
||||
node.text = node.text.replace(/\[`(\w+): ([^\]]+)`\]/g, (match, p1, p2) => {
|
||||
if (['event', 'method', 'property'].includes(p1)) {
|
||||
const memberName = p1 + ': ' + p2;
|
||||
const member = membersMap.get(memberName);
|
||||
if (!member)
|
||||
throw new Error('Undefined member references: ' + match);
|
||||
return linkRenderer({ member }) || match;
|
||||
}
|
||||
if (p1 === 'param') {
|
||||
let alias = p2;
|
||||
if (classOrMember) {
|
||||
@ -659,6 +660,7 @@ function patchLinks(classOrMember, spec, classesMap, membersMap, linkRenderer) {
|
||||
}
|
||||
if (p1 === 'option')
|
||||
return linkRenderer({ option: p2 }) || match;
|
||||
throw new Error(`Undefined link prefix, expected event|method|property|param|option, got: ` + match);
|
||||
});
|
||||
node.text = node.text.replace(/\[([\w]+)\]/g, (match, p1) => {
|
||||
const clazz = classesMap.get(p1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user