├── .editorconfig ├── .eslintignore ├── .eslintrc.json ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── bug.md │ ├── feature.md │ ├── question.md │ └── regression.md └── stale.yml ├── .gitignore ├── .prettierignore ├── .prettierrc ├── LICENSE ├── README.md ├── azure-pipelines-template.yml ├── azure-pipelines.yml ├── examples └── simple.js ├── lerna.json ├── logo.png ├── package.json ├── packages ├── expression-parser │ ├── README.md │ ├── index.js │ ├── package.json │ └── test │ │ ├── index.js │ │ ├── snapshots │ │ ├── index.js.md │ │ └── index.js.snap │ │ └── texpr.js ├── hast-util-from-webparser │ ├── LICENSE │ ├── README.md │ ├── index.ts │ ├── jest.config.js │ ├── package.json │ ├── test │ │ ├── __snapshots__ │ │ │ └── index.test.ts.snap │ │ └── index.test.ts │ ├── tsconfig.json │ └── tslint.json ├── prettyhtml-formatter │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ ├── stringify.js │ └── test │ │ ├── fixtures │ │ ├── angular │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── attribute-boolean │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── attribute-casesensitive │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── attribute-character-references │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── attribute-encoding │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── attribute-known-incasesensitive │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── attribute-no-quotes │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── attribute-quoting │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── attribute-single-quotes │ │ │ ├── config.json │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── auto-close-tags │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── camelCase-tags │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── case-sensitive-void-elements │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── comments-conditional │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── comments-elements │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── comments │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── custom-void-elements │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── doctype │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── entity-encoding │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── example │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── force-attribute-wrapping │ │ │ ├── config.json │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── form │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── gaps-preservation │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── html5-boilerplate │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── ignore-flag │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── image-tag │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── indent-default │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── indent-initial-default │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── indent-initial-false │ │ │ ├── config.json │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── indent-multiline-text │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── indent-number │ │ │ ├── config.json │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── indent-tabs │ │ │ ├── config.json │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── issue-65-white-space │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── issue-74-white-space │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── issue-79-gaps-preservation │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── mixed-documents │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── nested-templates │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── parent-insertion │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── preserve-attribute-wrapping-flag │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── preserve-boolean-attributes │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── preserve-explicit-namespace │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── preserve-whitespace-flag │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── prettier-embedded │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── print-width-custom │ │ │ ├── config.json │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── print-width-nested-tabs │ │ │ ├── config.json │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── print-width-nested │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── print-width-self-closing │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── print-width-tabs │ │ │ ├── config.json │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── print-width-void │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── print-width-with-inner-text │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── print-width │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── script-nested │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── script-no-prettier │ │ │ ├── config.json │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── self-closing-elements │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── soft-table-handling │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── structural-directives-angular │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── structural-directives-vue │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── style-different-type │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── style-no-prettier │ │ │ ├── config.json │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── style │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── table-foster-parenting │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── tag-casesensitive │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── template-expressions-angular │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── template-expressions-svelte │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── template-expressions-vue │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── void │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── vue │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── white-space-void │ │ │ ├── input.html │ │ │ └── output.html │ │ ├── white-space │ │ │ ├── input.html │ │ │ └── output.html │ │ └── whitespace-leading-text │ │ │ ├── input.html │ │ │ └── output.html │ │ └── index.js ├── prettyhtml-hast-to-html │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── lib │ │ ├── all.js │ │ ├── comment.js │ │ ├── constants.js │ │ ├── doctype.js │ │ ├── element.js │ │ ├── index.js │ │ ├── omission │ │ │ ├── closing.js │ │ │ ├── index.js │ │ │ ├── omission.js │ │ │ ├── opening.js │ │ │ └── util │ │ │ │ ├── first.js │ │ │ │ ├── place.js │ │ │ │ ├── siblings.js │ │ │ │ └── white-space-left.js │ │ ├── one.js │ │ ├── raw.js │ │ └── text.js │ ├── package.json │ └── test │ │ ├── attribute.js │ │ ├── comment.js │ │ ├── core.js │ │ ├── doctype.js │ │ ├── element.js │ │ ├── index.js │ │ ├── omission-closing-body.js │ │ ├── omission-closing-caption.js │ │ ├── omission-closing-colgroup.js │ │ ├── omission-closing-dd.js │ │ ├── omission-closing-dt.js │ │ ├── omission-closing-head.js │ │ ├── omission-closing-html.js │ │ ├── omission-closing-li.js │ │ ├── omission-closing-menuitem.js │ │ ├── omission-closing-optgroup.js │ │ ├── omission-closing-option.js │ │ ├── omission-closing-p.js │ │ ├── omission-closing-rp-rt.js │ │ ├── omission-closing-tbody.js │ │ ├── omission-closing-td-th.js │ │ ├── omission-closing-tfoot.js │ │ ├── omission-closing-thead.js │ │ ├── omission-closing-tr.js │ │ ├── omission-closing.js │ │ ├── omission-opening-body.js │ │ ├── omission-opening-colgroup.js │ │ ├── omission-opening-head.js │ │ ├── omission-opening-html.js │ │ ├── omission-opening-tbody.js │ │ ├── omission-opening.js │ │ ├── omission.js │ │ ├── raw.js │ │ ├── root.js │ │ ├── svg.js │ │ └── text.js ├── prettyhtml-hastscript │ ├── .editorconfig │ ├── LICENSE │ ├── README.md │ ├── factory.js │ ├── html.js │ ├── index.js │ ├── package.json │ ├── svg.js │ └── test.js ├── prettyhtml-quick │ ├── LICENSE │ ├── README.md │ ├── bin │ │ └── cli.js │ ├── lib │ │ └── git.js │ └── package.json ├── prettyhtml-sort-attributes │ ├── README.md │ ├── index.js │ ├── package.json │ └── test.js ├── prettyhtml │ ├── LICENSE │ ├── README.md │ ├── cli │ │ ├── args.js │ │ ├── index.js │ │ └── processor.js │ ├── index.d.ts │ ├── index.js │ ├── package.json │ ├── test-helpers │ │ ├── prepareVfile.js │ │ └── util.js │ └── test │ │ ├── api.js │ │ ├── cli.js │ │ └── snapshots │ │ ├── api.js.md │ │ ├── api.js.snap │ │ ├── cli.js.md │ │ └── cli.js.snap ├── rehype-minify-whitespace │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── list.js │ ├── package.json │ └── test.js ├── rehype-webparser │ ├── LICENSE │ ├── README.md │ ├── index.ts │ ├── jest.config.js │ ├── package.json │ ├── test │ │ └── index.test.ts │ ├── tsconfig.json │ └── tslint.json └── webparser │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── src │ ├── assertions.ts │ ├── ast.ts │ ├── ast_path.ts │ ├── ast_spec_utils.ts │ ├── chars.ts │ ├── html_parser.ts │ ├── html_tags.ts │ ├── html_whitespaces.ts │ ├── interpolation_config.ts │ ├── lexer.ts │ ├── parse_util.ts │ ├── parser.ts │ ├── public_api.ts │ ├── tags.ts │ └── util.ts │ ├── test │ ├── lexer.spec.ts │ └── parser.spec.ts │ ├── tsconfig.json │ └── tslint.json └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | # Change these settings to your own preference 10 | indent_style = space 11 | indent_size = 2 12 | space_after_anon_function = true 13 | 14 | # We recommend you to keep these unchanged 15 | end_of_line = lf 16 | charset = utf-8 17 | trim_trailing_whitespace = true 18 | insert_final_newline = true 19 | 20 | [**/fixtures/**/*.html] 21 | insert_final_newline = false 22 | trim_trailing_whitespace = false 23 | 24 | [*.md] 25 | trim_trailing_whitespace = false 26 | 27 | [*.js] 28 | quote_type = "single" 29 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | **/dist/** 2 | **/node_modules/** 3 | .nyc_output 4 | **/coverage/** 5 | packages/rehype-webparser 6 | packages/rehype-minify-whitespace 7 | packages/prettyhtml-sort-attributes 8 | packages/prettyhtml-hastscript 9 | packages/prettyhtml-hast-to-html 10 | packages/expression-parser -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "hemera", 3 | "globals": { 4 | "expect": true, 5 | "Code": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | *.html text eol=lf 4 | *.htm text eol=lf -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## 👉 [Please follow one of these issue templates](https://github.com/Prettyhtml/prettyhtml/issues/new/choose) 👈 2 | 3 | Note: to keep the backlog clean and actionable, issues may be immediately closed if they do not follow one of the above issue templates. 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🐛 Bug report 3 | about: Create a report to help us improve 4 | --- 5 | 6 | Before you submit an issue we recommend you drop into the [Gitter community](https://gitter.im/Prettyhtml/Lobby) and ask any questions you have or mention any problems you've had getting started with prettyhtml. 7 | 8 | ## 🐛 Bug Report 9 | 10 | A clear and concise description of what the bug is. 11 | 12 | ## To Reproduce 13 | 14 | 15 | 16 | Steps to reproduce the behavior: 17 | 18 | Paste your markup here: 19 | 20 | ```html 21 | 22 | ``` 23 | 24 | ## Expected behavior 25 | 26 | A clear and concise description of what you expected to happen. 27 | 28 | Paste the results here: 29 | 30 | ```html 31 | 32 | ``` 33 | 34 | ## Context 35 | 36 | 37 | 38 | - [ ] Angular 39 | - [ ] Svelte 40 | - [ ] Vue 41 | - [ ] Riot 42 | - [ ] HTML5 only 43 | 44 | ## Your Environment 45 | 46 | - Prettyhtml version: 47 | - NodeJs version: 48 | - Environment name and version: 49 | - Operating System and version: 50 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🚀 Feature Proposal 3 | about: Submit a proposal for a new feature 4 | --- 5 | 6 | ## 🚀 Feature Proposal 7 | 8 | 9 | 10 | A clear and concise description of what the feature is. 11 | 12 | ## Motivation 13 | 14 | Please outline the motivation for the proposal. 15 | 16 | ## Example 17 | 18 | Please provide an example for how this feature would be used. 19 | 20 | ## Vote 21 | 22 | If you agree with my proposal vote with a 👍 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 💬 Questions / Help 3 | about: If you have questions, please check our Gitter 4 | --- 5 | 6 | ## 💬 Questions and Help 7 | 8 | 9 | 10 | ### Please note that this issue tracker is not a help form and this issue will be closed. 11 | 12 | Before you submit an issue we recommend you drop into the [Gitter community](https://gitter.im/Prettyhtml/Lobby) and ask any questions you have or mention any problems you've had getting started with prettyhtml. 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/regression.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 💥 Regression Report 3 | about: Report unexpected behavior that worked in previous versions 4 | --- 5 | 6 | Before you submit an issue we recommend you drop into the [Gitter community](https://gitter.im/Prettyhtml/Lobby) and ask any questions you have or mention any problems you've had getting started with prettyhtml. 7 | 8 | ## 💥 Regression Report 9 | 10 | A clear and concise description of what the regression is. 11 | 12 | ## Last working version 13 | 14 | Worked up to version: 15 | 16 | Stopped working in version: 17 | 18 | ## To Reproduce 19 | 20 | 21 | 22 | Steps to reproduce the behavior: 23 | 24 | Paste your markup here: 25 | 26 | ```html 27 | 28 | ``` 29 | 30 | ## Expected behavior 31 | 32 | A clear and concise description of what you expected to happen. 33 | 34 | Paste the results here: 35 | 36 | ```html 37 | 38 | ``` 39 | 40 | ## Context 41 | 42 | 43 | 44 | - [ ] Angular 45 | - [ ] Svelte 46 | - [ ] Vue 47 | - [ ] Riot 48 | - [ ] HTML5 only 49 | 50 | ## Your Environment 51 | 52 | - Prettyhtml version: 53 | - NodeJs version: 54 | - Environment name and version: 55 | - Operating System and version: 56 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 15 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - 'bug' 8 | - 'good first issue' 9 | - 'help wanted' 10 | - 'proposal' 11 | - 'help wanted' 12 | # Label to use when marking an issue as stale 13 | staleLabel: wontfix 14 | # Comment to post when marking an issue as stale. Set to `false` to disable 15 | markComment: > 16 | This issue has been automatically marked as stale because it has not had 17 | recent activity. It will be closed if no further activity occurs. Thank you 18 | for your contributions. 19 | # Comment to post when closing a stale issue. Set to `false` to disable 20 | closeComment: false 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | # visual studio vode 64 | .vscode 65 | *.code-workspace 66 | 67 | # Ignore built ts files 68 | packages/*/dist/**/* 69 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | packages/prettyhtml-formatter/test/fixtures 3 | coverage 4 | packages/*/dist 5 | packages/*/coverage 6 | packages/*/.nyc_output 7 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 110, 3 | "semi": false, 4 | "singleQuote": true, 5 | "trailingComma": "none", 6 | "bracketSpacing": true 7 | } 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Dustin Deus 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /azure-pipelines-template.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - job: ${{ parameters.name }} 3 | pool: 4 | vmImage: ${{ parameters.vmImage }} 5 | strategy: 6 | matrix: 7 | node_8_x: 8 | node_version: 8.x 9 | node_10_x: 10 | node_version: 10.x 11 | maxParallel: 3 12 | steps: 13 | - task: NodeTool@0 14 | inputs: 15 | versionSpec: $(node_version) 16 | displayName: 'Install Node.js' 17 | - script: git config --global core.autocrlf false 18 | displayName: 'Git settings' 19 | - script: yarn 20 | displayName: 'Install dependencies' 21 | - script: yarn build-ts 22 | displayName: 'Build' 23 | - script: yarn test 24 | displayName: 'Run tests' 25 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: azure-pipelines-template.yml 3 | parameters: 4 | name: Linux 5 | vmImage: ubuntu-16.04 6 | 7 | - template: azure-pipelines-template.yml 8 | parameters: 9 | name: Windows 10 | vmImage: vs2017-win2016 11 | -------------------------------------------------------------------------------- /examples/simple.js: -------------------------------------------------------------------------------- 1 | const prettyhtml = require('./../packages/prettyhtml') 2 | 3 | // example with angular template 4 | try { 5 | const result = prettyhtml( 6 | `
` 7 | ) 8 | console.log(result.contents) 9 | } catch (error) { 10 | console.error(error) 11 | } 12 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "3.20.2", 3 | "packages": ["packages/*"], 4 | "useWorkspaces": true, 5 | "version": "0.10.1", 6 | "command": { 7 | "publish": { 8 | "registry": "https://registry.npmjs.org" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Prettyhtml/prettyhtml/5db9a8b7357d57a1997b6c293a9eaaab8afd6108/logo.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prettyhtml-repo", 3 | "private": true, 4 | "version": "0.0.0", 5 | "description": "", 6 | "scripts": { 7 | "publish": "lerna publish", 8 | "clean": "lerna clean", 9 | "prettify": "prettier --write \"./**/*.js\" --write \"./**/*.ts\"", 10 | "test": "lerna exec --parallel -- yarn test", 11 | "lint": "eslint .", 12 | "format": "prettier --write 'packages/**/*.{js,ts,md}'", 13 | "build-ts": "lerna exec --scope @starptech/webparser --scope @starptech/hast-util-from-webparser --scope @starptech/rehype-webparser -- yarn run build-ts" 14 | }, 15 | "husky": { 16 | "hooks": { 17 | "pre-commit": "yarn test && pretty-quick --staged" 18 | } 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/StarpTech/prettyhtml.git" 23 | }, 24 | "author": "Dustin Deus (http://www.starptech.de)", 25 | "license": "ISC", 26 | "bugs": { 27 | "url": "https://github.com/StarpTech/prettyhtml/issues" 28 | }, 29 | "homepage": "https://github.com/StarpTech/prettyhtml#readme", 30 | "devDependencies": { 31 | "eslint-config-airbnb-base": "^13.1.0", 32 | "eslint-config-hemera": "^1.0.0", 33 | "eslint-config-prettier": "^4.0.0", 34 | "eslint-plugin-import": "^2.16.0", 35 | "eslint-plugin-mocha": "^5.3.0", 36 | "eslint-plugin-node": "^8.0.1", 37 | "eslint-plugin-prettier": "^3.0.1", 38 | "eslint-plugin-promise": "^4.0.1", 39 | "@types/jest": "^24.0.6", 40 | "@types/node": "^11.9.4", 41 | "eslint": "^5.14.1", 42 | "husky": "^1.3.1", 43 | "lerna": "^3.20.2", 44 | "nyc": "^13.3.0", 45 | "prettier": "^1.16.4", 46 | "unist-util-inspect": "^4.1.3", 47 | "pretty-quick": "^1.10.0" 48 | }, 49 | "workspaces": [ 50 | "packages/*" 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /packages/expression-parser/README.md: -------------------------------------------------------------------------------- 1 | # @starptech/expression-parser 2 | 3 | Framework agnostic template expression parser 4 | 5 | ## Installation 6 | 7 | ``` 8 | npm install --save @starptech/expression-parser 9 | ``` 10 | 11 | ## Usage 12 | 13 | This example shows how we parse HTML 14 | 15 | ```js 16 | const parse = require('@starptech/expression-parser') 17 | const result = parse(`{ a + / b }`, { brackets: ['{', '}'] }) 18 | ``` 19 | 20 | ## Representation 21 | 22 | - `unescape`: Indentify a template marker as escaped. This information is useful to understand why a marker was skipped 23 | - `expressions`: A list of template expressions 24 | - `start`: Start position 25 | - `end`: End position 26 | - `text`: The content of the expression 27 | 28 | ```json 29 | { 30 | "unescape": "", 31 | "expressions": [ 32 | { 33 | "start": 1, 34 | "end": 19, 35 | "text": " a + / b " 36 | } 37 | ] 38 | } 39 | ``` 40 | 41 | ## Details 42 | 43 | There may be more than one expression as part of one attribute value or text node, or only one replacing the entire value or node. 44 | 45 | When used as the whole attribute value, there's no need to enclose the expression inside quotes, even if the expression contains whitespace. 46 | 47 | Single and double quotes can be nested inside the expression. 48 | 49 | To emit opening (left) brackets as literal text wherever an opening bracket is expected, the bracket must be prefixed with a backslash (the JS escape char '\'). This character is preserved in the output, but the parser will add a replace property for the attribute or node containing the escaped bracket, whose value is the bracket itself. 50 | 51 | ## Credits 52 | 53 | The parser is a modificated version of [Riot](https://github.com/riot/parser) template expression parser. 54 | -------------------------------------------------------------------------------- /packages/expression-parser/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@starptech/expression-parser", 3 | "version": "0.10.0", 4 | "description": "Framework agnostic template expression parser", 5 | "main": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/StarpTech/prettyhtml.git" 9 | }, 10 | "scripts": { 11 | "debug-test": "node --nolazy --inspect-brk=9229 node_modules/ava/profile.js -- ./test/index.js", 12 | "test-coverage": "nyc --reporter lcov ava ./test/index.js", 13 | "test": "ava ./test/index.js" 14 | }, 15 | "files": [ 16 | "index.js" 17 | ], 18 | "keywords": [ 19 | "formatter", 20 | "prettyhtml", 21 | "parser", 22 | "expressions", 23 | "angular", 24 | "vue", 25 | "riotjs", 26 | "html5" 27 | ], 28 | "author": "Dustin Deus (http://www.starptech.de)", 29 | "license": "MIT", 30 | "bugs": { 31 | "url": "https://github.com/StarpTech/prettyhtml/issues" 32 | }, 33 | "homepage": "https://github.com/StarpTech/prettyhtml#readme", 34 | "devDependencies": { 35 | "ava": "^2.1.0" 36 | }, 37 | "nyc": { 38 | "check-coverage": true, 39 | "lines": 90, 40 | "functions": 90, 41 | "branches": 85 42 | }, 43 | "publishConfig": { 44 | "access": "public" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /packages/expression-parser/test/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const test = require('ava') 4 | const parse = require('..') 5 | const tests = require('./texpr') 6 | 7 | function getOptions(opt) { 8 | return { 9 | brackets: ['{', '}'], 10 | ...opt 11 | } 12 | } 13 | 14 | Object.keys(tests).forEach(title => { 15 | test(title, function(t) { 16 | const test = tests[title] 17 | const result = parse(test.data, getOptions(test.options)) 18 | t.snapshot({ input: test.data, result }) 19 | }) 20 | }) 21 | -------------------------------------------------------------------------------- /packages/expression-parser/test/snapshots/index.js.snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Prettyhtml/prettyhtml/5db9a8b7357d57a1997b6c293a9eaaab8afd6108/packages/expression-parser/test/snapshots/index.js.snap -------------------------------------------------------------------------------- /packages/hast-util-from-webparser/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Dustin Deus 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/hast-util-from-webparser/README.md: -------------------------------------------------------------------------------- 1 | # @starptech/hast-util-from-webparser 2 | 3 | Produce [HAST](https://github.com/syntax-tree/hast) compatible AST from [Webparser](https://github.com/Prettyhtml/prettyhtml/tree/master/packages/webparser) 4 | 5 | ## Installation 6 | 7 | ``` 8 | @starptech/hast-util-from-webparser 9 | ``` 10 | 11 | ## Usage 12 | 13 | Say we have the following file, `example.html`: 14 | 15 | ```html 16 | Hello! 17 |

World!

18 | ``` 19 | 20 | And our script, `example.js`, looks as follows: 21 | 22 | ```javascript 23 | const vfile = require('to-vfile') 24 | const inspect = require('unist-util-inspect') 25 | const HtmlParser = require('@starptech/webparser').HtmlParser 26 | const fromWebparser = require('@starptech/hast-util-from-webparser') 27 | 28 | const filepath = 'example.html' 29 | const doc = vfile.readSync(filepath) 30 | const result = new HtmlParser({ 31 | ignoreFirstLf: false, 32 | decodeEntities: false, 33 | selfClosingCustomElements: true 34 | }).parse(String(doc), filepath) 35 | 36 | const hast = fromWebparser(result.rootNodes) 37 | ``` 38 | 39 | Now, running `node example` yields: 40 | 41 | ```text 42 | root[3] [data={"selfClosing":false}] 43 | ├─ doctype (1:1-1:15, 0-15) [name="html"] 44 | ├─ element[1] (1:15-1:36, 15-36) [tagName="title"][data={"selfClosing":false}] 45 | │ └─ text: "Hello!" (1:22-1:28, 22-28) 46 | └─ element[2] [tagName="h1"][properties={"id":"world"}][data={"selfClosing":false}] 47 | ├─ text: "World!" (1:51-1:57, 51-57) 48 | └─ comment: "after" (1:57-1:61, 57-61) 49 | ``` 50 | 51 | ## API 52 | 53 | ### `fromWebparser(rootNodes[, options])` 54 | 55 | Transform an `Node` to a [**HAST Node**](https://github.com/syntax-tree/hast#ast). 56 | -------------------------------------------------------------------------------- /packages/hast-util-from-webparser/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | globals: { 3 | 'ts-jest': { 4 | tsConfig: 'tsconfig.json' 5 | } 6 | }, 7 | moduleFileExtensions: ['ts', 'js'], 8 | transform: { 9 | '^.+\\.(ts|tsx)$': 'ts-jest' 10 | }, 11 | testMatch: ['**/test/**/*.test.ts', '**/__snapshot__/**/*.snap'], 12 | testEnvironment: 'node' 13 | } 14 | -------------------------------------------------------------------------------- /packages/hast-util-from-webparser/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@starptech/hast-util-from-webparser", 3 | "version": "0.10.0", 4 | "description": "", 5 | "main": "./dist/index.js", 6 | "scripts": { 7 | "start": "ts-node index.ts", 8 | "build-ts": "tsc", 9 | "watch-ts": "tsc -w", 10 | "test": "jest --forceExit --detectOpenHandles", 11 | "test-coverage": "yarn run test -- --coverage", 12 | "tslint": "tslint -c tslint.json -p tsconfig.json", 13 | "prepublish": "yarn run build-ts" 14 | }, 15 | "keywords": [ 16 | "formatter", 17 | "webparser", 18 | "hast", 19 | "html5" 20 | ], 21 | "author": "Dustin Deus (http://www.starptech.de)", 22 | "license": "MIT", 23 | "dependencies": { 24 | "@starptech/prettyhtml-hastscript": "^0.10.0", 25 | "@starptech/webparser": "^0.10.0", 26 | "property-information": "^5.1.0" 27 | }, 28 | "devDependencies": { 29 | "jest": "^24.8.0", 30 | "ts-jest": "^24.0.2", 31 | "ts-node": "^8.3.0", 32 | "tslint": "^5.17.0", 33 | "tslint-eslint-rules": "^5.4.0", 34 | "typescript": "^3.5.2", 35 | "vrsource-tslint-rules": "^6.0.0" 36 | }, 37 | "publishConfig": { 38 | "access": "public" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /packages/hast-util-from-webparser/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "esModuleInterop": true, 5 | "target": "es6", 6 | "noImplicitAny": true, 7 | "moduleResolution": "node", 8 | "sourceMap": true, 9 | "outDir": "dist", 10 | "baseUrl": "." 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/hast-util-from-webparser/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/vrsource-tslint-rules/rules", 4 | "node_modules/tslint-eslint-rules/dist/rules" 5 | ], 6 | "rules": { 7 | "no-console": [ 8 | true, 9 | "log" 10 | ], 11 | "no-duplicate-imports": true, 12 | "no-duplicate-variable": true, 13 | "no-jasmine-focus": true, 14 | "no-var-keyword": true, 15 | "semicolon": [ 16 | false 17 | ], 18 | "variable-name": [ 19 | true, 20 | "ban-keywords" 21 | ], 22 | "no-inner-declarations": [ 23 | true, 24 | "function" 25 | ], 26 | "no-debugger": true 27 | }, 28 | "jsRules": { 29 | "no-console": [ 30 | true, 31 | "log" 32 | ], 33 | "no-duplicate-imports": true, 34 | "no-duplicate-variable": true, 35 | "no-jasmine-focus": true, 36 | "semicolon": [ 37 | false 38 | ], 39 | "variable-name": [ 40 | true, 41 | "ban-keywords" 42 | ], 43 | "no-inner-declarations": [ 44 | true, 45 | "function" 46 | ] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Dustin Deus 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/README.md: -------------------------------------------------------------------------------- 1 | # @starptech/prettyhtml-formatter 2 | 3 | HTML formatter for [HAST](https://github.com/syntax-tree/hast) 4 | 5 | ## Installation 6 | 7 | ``` 8 | npm install --save @starptech/prettyhtml-formatter 9 | ``` 10 | 11 | ## Api 12 | 13 | ###### `node.data.ignore` 14 | 15 | When the data-property `ignore` is `true` the node is skipped for formatting. 16 | 17 | ## Caveats 18 | 19 | The implementation is a derivated from [**rehype-format Version 2.3.0**](https://github.com/rehypejs/rehype-format) rehype-format. 20 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@starptech/prettyhtml-formatter", 3 | "version": "0.10.0", 4 | "description": "Html formatter", 5 | "main": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/StarpTech/prettyhtml.git" 9 | }, 10 | "scripts": { 11 | "test-api": "node test/index.js", 12 | "test-coverage": "nyc --reporter lcov ava", 13 | "test": "ava", 14 | "test-snaphots": "ava --update-snapshots" 15 | }, 16 | "files": [ 17 | "index.js", 18 | "stringify.js" 19 | ], 20 | "keywords": [ 21 | "formatter", 22 | "prettyhtml", 23 | "html5" 24 | ], 25 | "author": "Dustin Deus (http://www.starptech.de)", 26 | "license": "MIT", 27 | "bugs": { 28 | "url": "https://github.com/StarpTech/prettyhtml/issues" 29 | }, 30 | "homepage": "https://github.com/StarpTech/prettyhtml#readme", 31 | "dependencies": { 32 | "@starptech/expression-parser": "^0.10.0", 33 | "@starptech/prettyhtml-hast-to-html": "^0.10.0", 34 | "@starptech/rehype-minify-whitespace": "^0.10.0", 35 | "@starptech/rehype-webparser": "^0.10.0", 36 | "@starptech/webparser": "^0.10.0", 37 | "hast-util-is-element": "^1.0.3", 38 | "hast-util-to-string": "^1.0.2", 39 | "html-void-elements": "^1.0.4", 40 | "html-whitespace-sensitive-tag-names": "^1.0.1", 41 | "is-hidden": "^1.1.2", 42 | "prettier": "^1.18.2", 43 | "repeat-string": "^1.6.1", 44 | "to-vfile": "^6.0.0", 45 | "unified": "^7.1.0", 46 | "unist-util-find": "^1.0.1", 47 | "unist-util-is": "^2.1.3", 48 | "unist-util-visit-parents": "^2.1.2", 49 | "xtend": "^4.0.1" 50 | }, 51 | "devDependencies": { 52 | "ava": "^2.1.0", 53 | "bail": "^1.0.4", 54 | "is-hidden": "^1.1.2", 55 | "negate": "^1.0.0", 56 | "nyc": "^14.1.1", 57 | "rehype": "^8.0.0", 58 | "to-vfile": "^6.0.0" 59 | }, 60 | "nyc": { 61 | "check-coverage": true, 62 | "lines": 90, 63 | "functions": 90, 64 | "branches": 85 65 | }, 66 | "publishConfig": { 67 | "access": "public" 68 | }, 69 | "gitHead": "c7bfe5fdd9ef240ddf235e50a81be52b30828c8f" 70 | } 71 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/stringify.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const xtend = require('xtend') 4 | const toHTML = require('@starptech/prettyhtml-hast-to-html') 5 | 6 | module.exports = stringify 7 | 8 | function stringify(config) { 9 | const settings = xtend(config, this.data('settings')) 10 | 11 | this.Compiler = compiler 12 | 13 | function compiler(tree) { 14 | return toHTML(tree, settings) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-boolean/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-boolean/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-casesensitive/input.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-casesensitive/output.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-character-references/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-character-references/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-encoding/input.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | 4 |

5 | 6 |
7 |
Special
8 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-encoding/output.html: -------------------------------------------------------------------------------- 1 |
7 |

8 | 9 |

10 | 11 |
    12 |
  • 13 |
14 |
Special
15 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-known-incasesensitive/input.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-known-incasesensitive/output.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-no-quotes/input.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-no-quotes/output.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-quoting/input.html: -------------------------------------------------------------------------------- 1 |

2 |

3 |

4 |

5 |

6 |

7 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-quoting/output.html: -------------------------------------------------------------------------------- 1 |

2 |

3 |

4 |

5 |

6 |

7 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-single-quotes/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-single-quotes/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/attribute-single-quotes/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/auto-close-tags/input.html: -------------------------------------------------------------------------------- 1 |
2 |

3 |
4 | 5 | 6 |
7 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/auto-close-tags/output.html: -------------------------------------------------------------------------------- 1 |
2 |

3 |
4 | 5 | 6 |
7 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/camelCase-tags/input.html: -------------------------------------------------------------------------------- 1 | This is valid. 2 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/camelCase-tags/output.html: -------------------------------------------------------------------------------- 1 | This is valid. 2 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/case-sensitive-void-elements/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/case-sensitive-void-elements/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/comments-conditional/input.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

foo

11 | 12 | 13 | 14 | 15 |
16 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/comments-conditional/output.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

foo

11 | 12 | 13 | 14 | 15 | 16 |
17 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/comments-elements/input.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 | 6 |
7 |
8 |
9 |
10 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/comments-elements/output.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 | 6 |
7 |
8 |
9 |
10 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/comments/input.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | foo 12 |
13 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/comments/output.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | foo 14 |
15 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/custom-void-elements/input.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/custom-void-elements/output.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/doctype/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/doctype/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/entity-encoding/input.html: -------------------------------------------------------------------------------- 1 |
&
2 |
foo > bar
3 |
foo < bar
4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/entity-encoding/output.html: -------------------------------------------------------------------------------- 1 |
&
2 |
foo > bar
3 |
foo < bar
4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/example/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 |
7 | {{ item.label }} 8 |
foo 9 |
baz
10 |
11 |
bar
12 | {{ item.label }} 13 | 14 |
15 |
16 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/example/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 |
7 | 12 | {{ item.label }} 13 |
14 | foo 15 |
baz
16 |
17 |
bar
18 | {{ item.label }} 23 |
24 |
25 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/force-attribute-wrapping/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "wrapAttributes": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/force-attribute-wrapping/input.html: -------------------------------------------------------------------------------- 1 |
2 |
6 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/force-attribute-wrapping/output.html: -------------------------------------------------------------------------------- 1 |
2 |
6 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/gaps-preservation/input.html: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/gaps-preservation/output.html: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/html5-boilerplate/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 |

Hello world! This is HTML5 Boilerplate.

25 | 26 | 27 | 28 | 29 | 30 | 31 | 39 | 40 | 41 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/html5-boilerplate/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 |

Hello world! This is HTML5 Boilerplate.

29 | 30 | 35 | 39 | 40 | 41 | 42 | 50 | 51 | 52 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/ignore-flag/input.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 |
  • First
  • Second
9 |
10 | 11 | 12 |
13 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/ignore-flag/output.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 7 |
8 | 9 |
  • First
  • Second
13 |
14 | 15 | 16 | 19 |
20 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/image-tag/input.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | foo 4 | 5 | 6 | 7 |
8 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/image-tag/output.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | foo 4 | 5 | 6 | 7 |
8 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-default/input.html: -------------------------------------------------------------------------------- 1 |

Foo 2 | bar 3 |

4 | Foo 5 | bar 6 | 7 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-default/output.html: -------------------------------------------------------------------------------- 1 |

2 | Foo 3 | bar 4 |

5 | 6 | Foo 7 | bar 8 | 9 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-initial-default/input.html: -------------------------------------------------------------------------------- 1 |
2 |

Foo

3 |
4 |
5 | Bar 6 | Baz 7 |
8 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-initial-default/output.html: -------------------------------------------------------------------------------- 1 |
2 |

Foo

3 |
4 |
5 | Bar 6 | Baz 7 |
8 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-initial-false/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "indentInitial": false 3 | } 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-initial-false/input.html: -------------------------------------------------------------------------------- 1 |
2 |

Bar

3 |
4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-initial-false/output.html: -------------------------------------------------------------------------------- 1 |
2 |

Bar

3 |
4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-multiline-text/input.html: -------------------------------------------------------------------------------- 1 | 6 | 12 |
13 | my text 14 | on multiple 15 | lines
16 |
17 |
18 | my text 19 | on multiple 20 | lines
21 | dedwedwed 22 | dwedwedwe 23 |
24 |
25 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-multiline-text/output.html: -------------------------------------------------------------------------------- 1 | 6 | 12 |
13 | my text 14 | on multiple 15 | lines 16 |
17 |
18 |
19 | my text 20 | on multiple 21 | lines 22 |
23 | dedwedwed 24 | dwedwedwe 25 |
26 |
27 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-number/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4 3 | } 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-number/input.html: -------------------------------------------------------------------------------- 1 |

Foo 2 | bar

3 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-number/output.html: -------------------------------------------------------------------------------- 1 |

2 | Foo 3 | bar 4 |

5 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-tabs/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-tabs/input.html: -------------------------------------------------------------------------------- 1 |

Foo 2 | bar

3 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/indent-tabs/output.html: -------------------------------------------------------------------------------- 1 |

2 | Foo 3 | bar 4 |

5 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/issue-65-white-space/input.html: -------------------------------------------------------------------------------- 1 |

I am writing to tell you that I am extremely excited about this new HTML formatter. It promises to be as far as I can tell both flexible and resilient in the face of many new ways of writing HTML

2 | 5 | 6 | 7 |

I am writing to tell you that I am 8 | extremely excited about this new 9 | HTML formatter. It promises to be 10 | as far as I can tell both 11 | flexible and 12 | resilient in the face of many new ways of writing 13 | HTML 14 |

15 | 18 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/issue-65-white-space/output.html: -------------------------------------------------------------------------------- 1 |

2 | I am writing to tell you that I am 3 | extremely excited about this new 4 | HTML formatter. It promises to be 5 | as far as I can tell both 6 | flexible and 7 | resilient in the face of many new ways of writing 8 | HTML 9 |

10 | 13 | 14 | 15 |

16 | I am writing to tell you that I am 17 | extremely excited about this new 18 | HTML formatter. It promises to be 19 | as far as I can tell both 20 | flexible and 21 | resilient in the face of many new ways of writing 22 | HTML 23 |

24 | 27 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/issue-74-white-space/input.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • Created: {{ user.created | timeAgo }} ago
  • 3 |
  • Karma: {{ user.karma }}
  • 4 |
  • 5 |
6 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/issue-74-white-space/output.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • 3 | Created: 4 | {{ user.created | timeAgo }} ago 5 |
  • 6 |
  • 7 | Karma: 8 | {{ user.karma }} 9 |
  • 10 |
  • 11 |
12 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/issue-79-gaps-preservation/input.html: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/issue-79-gaps-preservation/output.html: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 19 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/mixed-documents/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Document 1 5 | 6 | 7 |

foo1

8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Document 2 16 | 17 | 18 |

foo2

19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/mixed-documents/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Document 1 5 | 6 | 7 | 8 |

foo1

9 | 10 | 11 | 12 | 13 | 14 | 15 | Document 2 16 | 17 | 18 | 19 |

foo2

20 | 21 | 22 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/nested-templates/input.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/nested-templates/output.html: -------------------------------------------------------------------------------- 1 | 13 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/parent-insertion/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 |
15 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/parent-insertion/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/preserve-attribute-wrapping-flag/input.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 |
  • First
  • Second
9 |
10 | 11 | 12 | 15 |
16 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/preserve-attribute-wrapping-flag/output.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 6 |
7 |
16 | 19 |
20 | 21 |
    22 | 24 |
  • First
  • 25 | 27 |
  • Second
  • 28 | 30 |
31 |
41 | 42 | 43 | 46 |
47 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/preserve-boolean-attributes/input.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/preserve-boolean-attributes/output.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/preserve-explicit-namespace/input.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 |
7 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/preserve-explicit-namespace/output.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | 10 | 11 | 12 |
13 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/preserve-whitespace-flag/input.html: -------------------------------------------------------------------------------- 1 | 2 |
Check me out
3 |

foo

4 | 5 |
  • First
  • Second
9 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/preserve-whitespace-flag/output.html: -------------------------------------------------------------------------------- 1 | 2 |
Check me out
3 |

foo

4 | 5 |
  • First
  • Second
9 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/prettier-embedded/input.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 16 | 25 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/prettier-embedded/output.html: -------------------------------------------------------------------------------- 1 | 10 | 11 | 21 | 22 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-custom/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120 3 | } 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-custom/input.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-custom/output.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
10 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-nested-tabs/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-nested-tabs/input.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-nested-tabs/output.html: -------------------------------------------------------------------------------- 1 |
2 |
9 |
10 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-nested/input.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-nested/output.html: -------------------------------------------------------------------------------- 1 |
2 |
9 |
10 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-self-closing/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-self-closing/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-tabs/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-tabs/input.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-tabs/output.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
10 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-void/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-void/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-with-inner-text/input.html: -------------------------------------------------------------------------------- 1 |
dwedewdwedwedwedwedwedwedwedewdwedewddddddwedwedw
2 | 3 |
dwedewdwedwedwedwedwedwedwedewdwedewddddddwedwedwd
4 | 5 |
dwedewdwedwedwedwedwedwedwedewdwedewddddddwedwedw 6 |

foo

7 | 8 |
dwedewdwedwedwedwedwedwedwedewdwedewddddddwedwedwdddddddddddddddddddddddddddddddddddddddddddddd
12 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width-with-inner-text/output.html: -------------------------------------------------------------------------------- 1 |
dwedewdwedwedwedwedwedwedwedewdwedewddddddwedwedw
2 | 3 |
dwedewdwedwedwedwedwedwedwedewdwedewddddddwedwedwd
7 | 8 |
9 | dwedewdwedwedwedwedwedwedwedewdwedewddddddwedwedw 10 |

foo

11 |
12 | 13 |
dwedewdwedwedwedwedwedwedwedewdwedewddddddwedwedwdddddddddddddddddddddddddddddddddddddddddddddd
17 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width/input.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/print-width/output.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
10 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/script-nested/input.html: -------------------------------------------------------------------------------- 1 |
2 | 10 |
11 | 21 | 22 |
23 |
24 |
25 | 35 |
36 |
37 |
-------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/script-nested/output.html: -------------------------------------------------------------------------------- 1 |
2 | 10 |
11 | 21 | 22 |
23 |
24 |
25 | 35 |
36 |
37 |
38 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/script-no-prettier/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "usePrettier": false 3 | } 4 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/script-no-prettier/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/script-no-prettier/output.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/prettyhtml-formatter/test/fixtures/self-closing-elements/input.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 |