chrome-devtools-frontend
Version:
Chrome DevTools UI
28 lines (24 loc) • 1.11 kB
text/typescript
// Copyright (c) 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/*
To use links in markdown, add key here with the link and
use the added key in markdown.
@example markdown
Find more information about web development at [Learn more](exampleLink)
*/
// This is only exported for tests, and it should not be
// imported in any component, instead add link in map and
// use getMarkdownLink to get the appropriate link.
export const markdownLinks = new Map<string, string>([
['issuesContrastWCAG21AA', 'https://www.w3.org/TR/WCAG21/#contrast-minimum'],
['issuesContrastWCAG21AAA', 'https://www.w3.org/TR/WCAG21/#contrast-enhanced'],
['issuesContrastSuggestColor', 'https://developers.google.com/web/updates/2020/08/devtools#accessible-color'],
]);
export const getMarkdownLink = (key: string): string => {
const link = markdownLinks.get(key);
if (!link) {
throw new Error(`Markdown link with key '${key}' is not available, please check MarkdownLinksMap.ts`);
}
return link;
};