diff --git a/browser.js b/browser.js
new file mode 100644
index 0000000..53292b8
--- /dev/null
+++ b/browser.js
@@ -0,0 +1,2273 @@
+import { parsers as parsers$1 } from 'prettier/plugins/babel';
+import { doc } from 'prettier/standalone';
+import { parse } from 'svelte/compiler';
+
+// @see http://xahlee.info/js/html5_non-closing_tag.html
+const selfClosingTags = [
+ 'area',
+ 'base',
+ 'br',
+ 'col',
+ 'embed',
+ 'hr',
+ 'img',
+ 'input',
+ 'link',
+ 'meta',
+ 'param',
+ 'source',
+ 'track',
+ 'wbr',
+];
+// https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements#Elements
+const blockElements = [
+ 'address',
+ 'article',
+ 'aside',
+ 'blockquote',
+ 'details',
+ 'dialog',
+ 'dd',
+ 'div',
+ 'dl',
+ 'dt',
+ 'fieldset',
+ 'figcaption',
+ 'figure',
+ 'footer',
+ 'form',
+ 'h1',
+ 'h2',
+ 'h3',
+ 'h4',
+ 'h5',
+ 'h6',
+ 'header',
+ 'hgroup',
+ 'hr',
+ 'li',
+ 'main',
+ 'nav',
+ 'ol',
+ 'p',
+ 'pre',
+ 'section',
+ 'table',
+ 'ul',
+];
+/**
+ * HTML attributes that we may safely reformat (trim whitespace, add or remove newlines)
+ */
+const formattableAttributes = [
+// None at the moment
+// Prettier HTML does not format attributes at all
+// and to be consistent we leave this array empty for now
+];
+
+const snippedTagContentAttribute = '✂prettier:content✂';
+const scriptRegex = /|`}
+ getText(node, options, true)), embeddedOptions);
+ if (node.forceSingleLine) {
+ docs = removeLines(docs);
+ }
+ if (node.removeParentheses) {
+ docs = removeParentheses(docs);
+ }
+ return docs;
+ }
+ catch (e) {
+ return getText(node, options, true);
+ }
+ });
+ }
+ const embedType = (tag, parser, isTopLevel) => {
+ return (textToDoc, print) => __awaiter(this, void 0, void 0, function* () {
+ return embedTag(tag, options.originalText, path, (content) => formatBodyContent(content, parser, textToDoc, options), print, isTopLevel, options);
+ });
+ };
+ const embedScript = (isTopLevel) => embedType('script',
+ // Use babel-ts as fallback because the absence does not mean the content is not TS,
+ // the user could have set the default language. babel-ts will format things a little
+ // bit different though, especially preserving parentheses around dot notation which
+ // fixes https://github.com/sveltejs/prettier-plugin-svelte/issues/218
+ isTypeScript(node) ? 'typescript' : 'babel-ts', isTopLevel);
+ const embedStyle = (isTopLevel) => embedType('style', isLess(node) ? 'less' : isScss(node) ? 'scss' : 'css', isTopLevel);
+ const embedPug = () => embedType('template', 'pug', false);
+ switch (node.type) {
+ case 'Script':
+ return embedScript(true);
+ case 'Style':
+ return embedStyle(true);
+ case 'Element': {
+ if (node.name === 'script') {
+ return embedScript(false);
+ }
+ else if (node.name === 'style') {
+ return embedStyle(false);
+ }
+ else if (isPugTemplate(node)) {
+ return embedPug();
+ }
+ }
+ }
+ return null;
+}
+function forceIntoExpression(statement) {
+ // note the trailing newline: if the statement ends in a // comment,
+ // we can't add the closing bracket right afterwards
+ return `(${statement}\n)`;
+}
+function preformattedBody(str) {
+ if (!str) {
+ return '';
+ }
+ const firstNewline = /^[\t\f\r ]*\n/;
+ const lastNewline = /\n[\t\f\r ]*$/;
+ // If we do not start with a new line prettier might try to break the opening tag
+ // to keep it together with the string. Use a literal line to skip indentation.
+ return [literalline$1, str.replace(firstNewline, '').replace(lastNewline, ''), hardline$1];
+}
+function getSnippedContent(node) {
+ const encodedContent = getAttributeTextValue(snippedTagContentAttribute, node);
+ if (encodedContent) {
+ return Buffer.from(encodedContent, 'base64').toString('utf-8');
+ }
+ else {
+ return '';
+ }
+}
+function formatBodyContent(content, parser, textToDoc, options) {
+ return __awaiter(this, void 0, void 0, function* () {
+ try {
+ const body = yield textToDoc(content, { parser });
+ if (parser === 'pug' && typeof body === 'string') {
+ // Pug returns no docs but a final string.
+ // Therefore prepend the line offsets
+ const whitespace = options.useTabs
+ ? '\t'
+ : ' '.repeat(options.pugTabWidth && options.pugTabWidth > 0
+ ? options.pugTabWidth
+ : options.tabWidth);
+ const pugBody = body
+ .split('\n')
+ .map((line) => (line ? whitespace + line : line))
+ .join('\n');
+ return [hardline$1, pugBody];
+ }
+ const indentIfDesired = (doc) => options.svelteIndentScriptAndStyle ? indent$1(doc) : doc;
+ trimRight([body], isLine);
+ return [indentIfDesired([hardline$1, body]), hardline$1];
+ }
+ catch (error) {
+ if (process.env.PRETTIER_DEBUG) {
+ throw error;
+ }
+ // We will wind up here if there is a syntax error in the embedded code. If we throw an error,
+ // prettier will try to print the node with the printer. That will fail with a hard-to-interpret
+ // error message (e.g. "Unsupported node type", referring to ``}\n getText(node, options, true),\n ),\n embeddedOptions,\n );\n if (node.forceSingleLine) {\n docs = removeLines(docs);\n }\n if (node.removeParentheses) {\n docs = removeParentheses(docs);\n }\n return docs;\n } catch (e) {\n return getText(node, options, true);\n }\n };\n }\n\n const embedType = (\n tag: 'script' | 'style' | 'template',\n parser: 'typescript' | 'babel-ts' | 'css' | 'scss' | 'less' | 'pug',\n isTopLevel: boolean,\n ) => {\n return async (\n textToDoc: (text: string, options: Options) => Promise,\n print: PrintFn,\n ): Promise => {\n return embedTag(\n tag,\n options.originalText,\n path,\n (content) => formatBodyContent(content, parser, textToDoc, options),\n print,\n isTopLevel,\n options,\n );\n };\n };\n\n const embedScript = (isTopLevel: boolean) =>\n embedType(\n 'script',\n // Use babel-ts as fallback because the absence does not mean the content is not TS,\n // the user could have set the default language. babel-ts will format things a little\n // bit different though, especially preserving parentheses around dot notation which\n // fixes https://github.com/sveltejs/prettier-plugin-svelte/issues/218\n isTypeScript(node) ? 'typescript' : 'babel-ts',\n isTopLevel,\n );\n const embedStyle = (isTopLevel: boolean) =>\n embedType('style', isLess(node) ? 'less' : isScss(node) ? 'scss' : 'css', isTopLevel);\n const embedPug = () => embedType('template', 'pug', false);\n\n switch (node.type) {\n case 'Script':\n return embedScript(true);\n case 'Style':\n return embedStyle(true);\n case 'Element': {\n if (node.name === 'script') {\n return embedScript(false);\n } else if (node.name === 'style') {\n return embedStyle(false);\n } else if (isPugTemplate(node)) {\n return embedPug();\n }\n }\n }\n\n return null;\n}\n\nfunction forceIntoExpression(statement: string) {\n // note the trailing newline: if the statement ends in a // comment,\n // we can't add the closing bracket right afterwards\n return `(${statement}\\n)`;\n}\n\nfunction preformattedBody(str: string): Doc {\n if (!str) {\n return '';\n }\n\n const firstNewline = /^[\\t\\f\\r ]*\\n/;\n const lastNewline = /\\n[\\t\\f\\r ]*$/;\n\n // If we do not start with a new line prettier might try to break the opening tag\n // to keep it together with the string. Use a literal line to skip indentation.\n return [literalline, str.replace(firstNewline, '').replace(lastNewline, ''), hardline];\n}\n\nfunction getSnippedContent(node: Node) {\n const encodedContent = getAttributeTextValue(snippedTagContentAttribute, node);\n\n if (encodedContent) {\n return Buffer.from(encodedContent, 'base64').toString('utf-8');\n } else {\n return '';\n }\n}\n\nasync function formatBodyContent(\n content: string,\n parser: 'typescript' | 'babel-ts' | 'css' | 'scss' | 'less' | 'pug',\n textToDoc: (text: string, options: object) => Promise,\n options: ParserOptions & { pugTabWidth?: number },\n) {\n try {\n const body = await textToDoc(content, { parser });\n\n if (parser === 'pug' && typeof body === 'string') {\n // Pug returns no docs but a final string.\n // Therefore prepend the line offsets\n const whitespace = options.useTabs\n ? '\\t'\n : ' '.repeat(\n options.pugTabWidth && options.pugTabWidth > 0\n ? options.pugTabWidth\n : options.tabWidth,\n );\n const pugBody = body\n .split('\\n')\n .map((line) => (line ? whitespace + line : line))\n .join('\\n');\n return [hardline, pugBody];\n }\n\n const indentIfDesired = (doc: Doc) =>\n options.svelteIndentScriptAndStyle ? indent(doc) : doc;\n trimRight([body], isLine);\n return [indentIfDesired([hardline, body]), hardline];\n } catch (error) {\n if (process.env.PRETTIER_DEBUG) {\n throw error;\n }\n\n // We will wind up here if there is a syntax error in the embedded code. If we throw an error,\n // prettier will try to print the node with the printer. That will fail with a hard-to-interpret\n // error message (e.g. \"Unsupported node type\", referring to `