Skip to content

Commit

Permalink
Merge pull request #3 from Marhc/feature/add-json-markdown-support
Browse files Browse the repository at this point in the history
Adds support for JSON and Markdown (resolve #2)
  • Loading branch information
PerfectPan committed Apr 3, 2024
2 parents 22d19f3 + 09a0289 commit 3fad326
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/language-map.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import parserBabel from 'prettier/parser-babel';
import parserTypeScript from 'prettier/parser-typescript';
import parserHTML from 'prettier/parser-html';
import parserMarkdown from 'prettier/parser-markdown';
import parserCSS from 'prettier/parser-postcss';

export type SupportedLanguage = 'js' | 'javascript' | 'ts' | 'typescript' | 'html' | 'css' | 'less' | 'scss';
export type SupportedLanguage = 'js' | 'json' | 'javascript' | 'ts' | 'typescript' | 'html' | 'css' | 'less' | 'scss' | 'markdown';

interface IPrettierOption {
parser: string;
Expand All @@ -15,6 +16,10 @@ export const languageMap: Record<SupportedLanguage, IPrettierOption> = {
parser: 'babel',
plugins: [parserBabel]
},
json: {
parser: 'json',
plugins: [parserBabel]
},
javascript: {
parser: 'babel',
plugins: [parserBabel]
Expand Down Expand Up @@ -43,4 +48,8 @@ export const languageMap: Record<SupportedLanguage, IPrettierOption> = {
parser: 'css',
plugins: [parserCSS]
},
markdown: {
parser: 'markdown',
plugins: [parserMarkdown]
},
}

0 comments on commit 3fad326

Please sign in to comment.