From 2b737bb5b453850d9612d7dfc16ed9192687f51e Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Mon, 15 Oct 2018 16:53:38 +0530 Subject: [PATCH] support json mode and prettifying --- src/components/ContentWrapFiles.jsx | 3 +++ src/utils.js | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/components/ContentWrapFiles.jsx b/src/components/ContentWrapFiles.jsx index eda83e7..faa0d03 100644 --- a/src/components/ContentWrapFiles.jsx +++ b/src/components/ContentWrapFiles.jsx @@ -141,6 +141,9 @@ export default class ContentWrapFiles extends Component { CodeMirror.autoLoadMode(this.cm, mode); } + if (mime === 'application/json') { + mime = 'application/ld+json'; + } this.fileBuffers[file.path] = CodeMirror.Doc( file.content || '', detectedMode ? mime : 'text/plain' diff --git a/src/utils.js b/src/utils.js index 58b895a..469a3e2 100644 --- a/src/utils.js +++ b/src/utils.js @@ -477,6 +477,10 @@ export function prettify(file) { parser = 'babylon'; plugins = [require('prettier/parser-babylon')]; break; + case 'json': + parser = 'json'; + plugins = [require('prettier/parser-babylon')]; + break; case 'css': parser = 'css'; plugins = [require('prettier/parser-postcss')];