From 3b617b37094829e0505e780b7269c9e293e05be4 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Fri, 8 Jan 2021 16:36:52 -0800 Subject: [PATCH] docs: validate member links (#4955) --- docs/src/auth.md | 2 +- utils/doclint/cli.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/src/auth.md b/docs/src/auth.md index b5eb99da5b..3823876738 100644 --- a/docs/src/auth.md +++ b/docs/src/auth.md @@ -69,7 +69,7 @@ existing authentication state in new browser contexts. Web apps use cookie-based or token-based authentication, where authenticated state is stored as [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) or in [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage). -Playwright provides [`method: Browser.storageState`] method that can be used to retrieve storage state from authenticated contexts and then create new contexts with prepopulated state. +Playwright provides [`method: BrowserContext.storageState`] method that can be used to retrieve storage state from authenticated contexts and then create new contexts with prepopulated state. Cookies and local storage state can be used across different browsers. They depend on your application's authentication model: some apps might require both cookies diff --git a/utils/doclint/cli.js b/utils/doclint/cli.js index 2002ffb606..3e4310e098 100755 --- a/utils/doclint/cli.js +++ b/utils/doclint/cli.js @@ -22,6 +22,7 @@ const fs = require('fs'); const path = require('path'); const { parseApi } = require('./api_parser'); const missingDocs = require('./missingDocs'); +const md = require('../markdown'); /** @typedef {import('./documentation').Type} Type */ /** @typedef {import('../markdown').MarkdownNode} MarkdownNode */ @@ -64,6 +65,16 @@ async function run() { writeAssumeNoop(path.join(PROJECT_DIR, 'README.md'), content, dirtyFiles); } + // Validate links + { + for (const file of fs.readdirSync(path.join(PROJECT_DIR, 'docs', 'src'))) { + if (!file.endsWith('.md')) + continue; + const data = fs.readFileSync(path.join(PROJECT_DIR, 'docs', 'src', file)).toString(); + documentation.renderLinksInText(md.parse(data)); + } + } + // Check for missing docs { const srcClient = path.join(PROJECT_DIR, 'src', 'client');