UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

39 lines (34 loc) 1.08 kB
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import prettier from 'prettier/standalone'; import plugins from 'prettier/parser-html'; import { removeUnprintableChar } from '../utils'; export var HTMLFormatter = /*#__PURE__*/function () { function HTMLFormatter() { _classCallCheck(this, HTMLFormatter); } _createClass(HTMLFormatter, [{ key: "getFormatted", value: function getFormatted(rawText) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : HTMLFormatter.defaultOptions; var t = rawText; try { t = prettier.format(rawText, options); } catch (error) {// } return t; } }, { key: "getRaw", value: function getRaw(formattedText) { return removeUnprintableChar(formattedText); } }]); return HTMLFormatter; }(); HTMLFormatter.defaultOptions = { parser: 'html', plugins: [plugins] }; export default new HTMLFormatter(); //# sourceMappingURL=HTMLFormatter.js.map