[ci] format

This commit is contained in:
natemoo-re 2022-06-10 03:33:13 +00:00 committed by github-actions[bot]
parent 7f5e71982d
commit 4eb39d57b9
4 changed files with 18 additions and 23 deletions

View file

@ -101,7 +101,7 @@ export async function renderMarkdown(
.use(rehypeEscape)
.use(rehypeIslands)
.use([rehypeCollectHeaders])
.use(rehypeStringify, { allowDangerousHtml: true })
.use(rehypeStringify, { allowDangerousHtml: true });
let result: string;
try {

View file

@ -1,5 +1,5 @@
import type { RehypePlugin } from './types.js';
import { visit } from 'unist-util-visit';
import type { RehypePlugin } from './types.js';
const MDX_ELEMENTS = ['mdxJsxFlowElement', 'mdxJsxTextElement'];
@ -36,12 +36,11 @@ export default function rehypeJsx(): ReturnType<RehypePlugin> {
// from creating a nested link to `www.example.com`
if (node.name === 'a') {
visit(node, 'element', (el, elIndex, elParent) => {
const isAutolink = (
const isAutolink =
el.tagName === 'a' &&
el.children.length === 1 &&
el.children[0].type === 'text' &&
el.children[0].value.match(/^(https?:\/\/|www\.)/i)
);
el.children[0].value.match(/^(https?:\/\/|www\.)/i);
// If we found an autolink, remove it by replacing it with its text-only child
if (isAutolink) {

View file

@ -3,10 +3,7 @@ import chai from 'chai';
describe('autolinking', () => {
it('autolinks URLs starting with a protocol in plain text', async () => {
const { code } = await renderMarkdown(
`See https://example.com for more.`,
{}
);
const { code } = await renderMarkdown(`See https://example.com for more.`, {});
chai
.expect(code.replace(/\n/g, ''))
@ -14,10 +11,7 @@ describe('autolinking', () => {
});
it('autolinks URLs starting with "www." in plain text', async () => {
const { code } = await renderMarkdown(
`See www.example.com for more.`,
{}
);
const { code } = await renderMarkdown(`See www.example.com for more.`, {});
chai
.expect(code.trim())
@ -32,8 +26,10 @@ describe('autolinking', () => {
chai
.expect(code.trim())
.to.equal(`<p>See <code is:raw>https://example.com</code> or ` +
`<code is:raw>www.example.com</code> for more.</p>`);
.to.equal(
`<p>See <code is:raw>https://example.com</code> or ` +
`<code is:raw>www.example.com</code> for more.</p>`
);
});
it('does not autolink URLs in fenced code blocks', async () => {

View file

@ -1,5 +1,5 @@
export { pathToPosix } from './lib/utils';
export { AbortController, AbortSignal, alert, atob, Blob, btoa, ByteLengthQueuingStrategy, cancelAnimationFrame, cancelIdleCallback, CanvasRenderingContext2D, CharacterData, clearTimeout, Comment, CountQueuingStrategy, CSSStyleSheet, CustomElementRegistry, CustomEvent, Document, DocumentFragment, DOMException, Element, Event, EventTarget, fetch, File, FormData, Headers, HTMLBodyElement, HTMLCanvasElement, HTMLDivElement, HTMLDocument, HTMLElement, HTMLHeadElement, HTMLHtmlElement, HTMLImageElement, HTMLSpanElement, HTMLStyleElement, HTMLTemplateElement, HTMLUnknownElement, Image, ImageData, IntersectionObserver, MediaQueryList, MutationObserver, Node, NodeFilter, NodeIterator, OffscreenCanvas, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, Request, requestAnimationFrame, requestIdleCallback, ResizeObserver, Response, setTimeout, ShadowRoot, structuredClone, StyleSheet, Text, TransformStream, TreeWalker, URLPattern, Window, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter, } from './mod.js';
export { AbortController, AbortSignal, alert, atob, Blob, btoa, ByteLengthQueuingStrategy, cancelAnimationFrame, cancelIdleCallback, CanvasRenderingContext2D, CharacterData, clearTimeout, Comment, CountQueuingStrategy, CSSStyleSheet, CustomElementRegistry, CustomEvent, Document, DocumentFragment, DOMException, Element, Event, EventTarget, fetch, File, FormData, Headers, HTMLBodyElement, HTMLCanvasElement, HTMLDivElement, HTMLDocument, HTMLElement, HTMLHeadElement, HTMLHtmlElement, HTMLImageElement, HTMLSpanElement, HTMLStyleElement, HTMLTemplateElement, HTMLUnknownElement, Image, ImageData, IntersectionObserver, MediaQueryList, MutationObserver, Node, NodeFilter, NodeIterator, OffscreenCanvas, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, Request, requestAnimationFrame, requestIdleCallback, ResizeObserver, Response, setTimeout, ShadowRoot, structuredClone, StyleSheet, Text, TransformStream, TreeWalker, URLPattern, Window, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter } from './mod.js';
export declare const polyfill: {
(target: any, options?: PolyfillOptions): any;
internals(target: any, name: string): any;