Skip to content
This repository has been archived by the owner on Sep 2, 2020. It is now read-only.

Commit

Permalink
Merge tag 'fix-use-in-browser' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mistlog committed Jan 18, 2020
2 parents 4f728d5 + 8d7e103 commit cfa52db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "source-view",
"version": "0.0.4",
"version": "0.0.5",
"description": "A simple tool for turning code into document.",
"keywords": [
"literate programming",
Expand Down
9 changes: 6 additions & 3 deletions src/source-view.ts
@@ -1,7 +1,8 @@
import { isTSTypeAliasDeclaration, isExportNamedDeclaration, isExpressionStatement, Node, File, isImportDeclaration, isEmptyStatement, Comment } from "@babel/types";
import generate from "@babel/generator";
import { parse } from "@babel/parser";
import * as prettier from "prettier";
import * as prettier from "prettier/standalone";
import * as TypescriptParser from "prettier/parser-typescript";

export function CodeToMarkdown(code: string)
{
Expand Down Expand Up @@ -39,7 +40,8 @@ class SourceView
{
const code = prettier.format(raw, {
parser: "typescript",
semi: false
semi: false,
plugins: [TypescriptParser] // babel bug: https://github.com/babel/babel/issues/8837
});
return code;
}
Expand Down Expand Up @@ -134,7 +136,8 @@ class SourceView
const code = prettier.format(raw, {
parser: "typescript",
printWidth: 200,
tabWidth: 4
tabWidth: 4,
plugins: [TypescriptParser]
});
return code;
}
Expand Down

0 comments on commit cfa52db

Please sign in to comment.