Skip to content

Commit 3fad326

Browse files
authored
Merge pull request #3 from Marhc/feature/add-json-markdown-support
Adds support for JSON and Markdown (resolve #2)
2 parents 22d19f3 + 09a0289 commit 3fad326

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/language-map.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import parserBabel from 'prettier/parser-babel';
22
import parserTypeScript from 'prettier/parser-typescript';
33
import parserHTML from 'prettier/parser-html';
4+
import parserMarkdown from 'prettier/parser-markdown';
45
import parserCSS from 'prettier/parser-postcss';
56

6-
export type SupportedLanguage = 'js' | 'javascript' | 'ts' | 'typescript' | 'html' | 'css' | 'less' | 'scss';
7+
export type SupportedLanguage = 'js' | 'json' | 'javascript' | 'ts' | 'typescript' | 'html' | 'css' | 'less' | 'scss' | 'markdown';
78

89
interface IPrettierOption {
910
parser: string;
@@ -15,6 +16,10 @@ export const languageMap: Record<SupportedLanguage, IPrettierOption> = {
1516
parser: 'babel',
1617
plugins: [parserBabel]
1718
},
19+
json: {
20+
parser: 'json',
21+
plugins: [parserBabel]
22+
},
1823
javascript: {
1924
parser: 'babel',
2025
plugins: [parserBabel]
@@ -43,4 +48,8 @@ export const languageMap: Record<SupportedLanguage, IPrettierOption> = {
4348
parser: 'css',
4449
plugins: [parserCSS]
4550
},
51+
markdown: {
52+
parser: 'markdown',
53+
plugins: [parserMarkdown]
54+
},
4655
}

0 commit comments

Comments
 (0)