blob: c6c07ee637d7455145e71eed8138509857ab3c9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import type { Options } from 'prettier';
import { format } from 'prettier';
import prettierConfig from '../../../.prettierrc.js';
/**
* Formats Markdown contents.
*
* @param text The text to format.
*/
export async function formatMarkdown(text: string): Promise<string> {
return format(text, prettierMarkdown);
}
/**
* Formats TypeScript contents.
*
* @param text The text to format.
*/
export async function formatTypescript(text: string): Promise<string> {
return format(text, prettierTypescript);
}
const prettierMarkdown: Options = {
...prettierConfig,
parser: 'markdown',
};
const prettierTypescript: Options = {
...prettierConfig,
parser: 'typescript',
};
|