Commit Graph
39 Commits
Author SHA1 Message Date
fisker Cheung e199e68bff Format script content inside HTML tag with colon (#7916)
* Format script content inside HTML tag with colon

* Fix mistake
2020-04-01 20:35:58 +03:00
Georgii Dolzhykov 9dad95b35f Bump Prettier dependency to 2.0.0 2020-03-21 22:09:54 +02:00
Graeme Worthy 7f2b103cf6 Support <!-- prettier ignore --> for text (#7654) 2020-02-25 13:11:08 +02:00
Shinigami 59e15ec744 Use spread syntax (convert to es2015) (#6317) 2020-02-25 03:05:49 +02:00
Georgii Dolzhykov 37a7e9cd42 Merge branch 'master' into next 2020-01-22 14:55:22 +02:00
Cyrille David 97a878632c Support printing inline handlebars in html (through embed function) (#7306)
* Move old handlebars to html file

This kind of handlebars code is supposed to be in html files.

* Remove useless file

* Uglify our old handlebars file

* Move venerable hbs tests to their folder

Because of their config

* html: Use glimmer for script tags of type handlebars

* Record snapshots

* Add CHANGELOG entry

* Add the CHANGELOG test

* Make the PR changes more obvious
2020-01-21 08:55:29 +02:00
fisker Cheung 9900174d50 HTML: don't treat colons as namespace prefix delimiters in tag names (#7273) 2020-01-20 16:39:19 +02:00
fisker Cheung 5330d9d4a6 Fix error throws on unclosed tag in pre (#7392) 2020-01-20 13:49:36 +03:00
Georgii Dolzhykov 7e3c0c73b3 Merge branch 'master' into next 2020-01-14 20:36:21 +02:00
fisker Cheung 02c161cf33 Fix: don't throw on broken html (#7293) 2020-01-13 17:31:03 +03:00
Georgii Dolzhykov 42e7f7f1a5 Merge remote-tracking branch 'remotes/upstream/master' into next 2020-01-09 16:55:41 +02:00
Sosuke Suzuki 332a55179e Vue: format sfc jsx (#7180)
* Modify to enable to format vue jsx sfc

* add changelog

* Modify to avoid cspell checking, "sfcs" -> "SFC"
2020-01-09 05:14:19 +09:00
Panayiotis Lipiridis 35fe9ccada Merge with master 2020-01-08 14:43:19 +02:00
Selvazhagan 024f51e5f8 Fixes : #5915 HTML comments in pre tags causes bad formatting o… (#5959) 2020-01-06 21:00:09 +02:00
fisker Cheung 57f0dd56dd Replace indexOf with includes (#6967)
* Replace `indexOf` with `includes`

* Add `unicorn/prefer-includes`
2019-11-17 11:06:14 +01:00
Simon Lydell 98d27c7de2 Bump Prettier dependency to 1.19.0 2019-11-09 01:14:31 +01:00
fisker Cheung 460ea2f459 Format style[lang="css"] (#6875) 2019-11-08 19:33:59 +01:00
Sosuke Suzuki d66c5f82da fix(HTML, Vue): don't break the template element included in a line shorter than print-width (#6284) 2019-08-08 15:18:37 +03:00
Matt KaneandSimon Lydell 7286413ee5 Add JSON script types (#6293)
* Add JSON mimetypes

* Use endsWith

Co-Authored-By: Simon Lydell <simon.lydell@gmail.com>
2019-07-22 16:48:03 +03:00
Wei-Wei Wu 91c20f7fbe Rename "babylon" with "babel" (#5647) 2018-12-27 21:05:19 +08:00
Ika cbf06bf388 feat(html): format script with "application/ld+json" (#5642) 2018-12-16 16:21:10 +08:00
Ika d97fe0a1e0 feat(html): preserve surrounding linebreaks (#5596) 2018-12-11 12:43:53 +08:00
Ika 952bc0cc03 fix: get rid of CRLF (#5494) 2018-12-08 18:28:29 +08:00
Ika cd28c22dbe feat(html): smart quote for attributes (#5590) 2018-12-05 11:15:09 +08:00
Ika 7da4ed76ad fix(html): do not touch comments (#5525) 2018-11-23 21:25:58 +08:00
Ika b2eadd234b fix(vue): preserve custom block (#5458) 2018-11-23 12:33:48 +08:00
Ika 4f63be05e8 fix(html): leading space for leading interpolation in textarea is sensitive (#5468) 2018-11-15 10:34:42 +08:00
Ika 182a92eb28 fix(html): preserve incomplete ie conditional comment (#5429) 2018-11-10 16:44:44 +08:00
Ika 1bce579f8d fix(ng|vue): whitespaces between interpolation and text are sensitive (#5396) 2018-11-10 01:00:26 +08:00
Ika de11f69889 fix(html): preserve unterminated ie conditional comments (#5424) 2018-11-09 23:26:59 +08:00
Ika 6f6b634948 fix(html): preserve content for <template> with unknown lang (#5388) 2018-11-09 19:19:03 +08:00
Ika 9acb02997a feat(html): treat capital element as custom element (#5395)
Custom element: keep it on its own line if both leading/trailing line breaks exist
2018-11-09 09:51:31 +08:00
Ika 0228863a92 feat(html): handle pre with interpolation (#5400) 2018-11-09 09:50:57 +08:00
Ika 514b6d3741 Bump Prettier dependency to 1.15.0 2018-11-07 09:12:25 +08:00
Ika 5e8a4a115a feat: support HTML/Vue/Angular (#5259) 2018-11-04 23:03:07 +08:00
Ika dd4687e7ef feat(html): whitespace-sensitive formatting (#5168)
- whitespace-sensitive formatting 
  - respect css `display: block`/`white-space: pre` (data from [`html-styles`](https://github.com/marionebl/html-styles))
  - support magic comment (`<!-- display: block -->`)
  - add an option to specify whitespace sensitivity (`--html-whitespace-sensitivity <css|strict|ignore>`)
    - magic comments take precedence
    - (default) `css`: respect default css style (safe in the most cases)
    - `strict`: every node is considered whitespace sensitive (the safest)
    - `ignore`: every node is considered whitespace insensitive (dangerous, the original behavior)
  - inline inline-tags 
- support ie conditional comment (`<!--[if IE]><![endif]-->`)
- indent the script/style content
- no inconsistent output for 2+ attributes
- force break tag if there're multiline attributes
2018-10-13 13:55:38 +08:00
Ika 07abf0588e fix(html): non-HTML attributes are considered case-sensitive (#5135) 2018-09-27 20:18:00 +08:00
Ika 13147facc5 feat(html): switch to htmlparser2 (#5127)
- switch to [`htmlparser2`](https://github.com/fb55/htmlparser2)
  - no need to fork
  - won't generate pseudo nodes ([`parse5` will](https://github.com/prettier/prettier/issues/5098#issuecomment-423055181))
  - should be [faster](https://github.com/fb55/htmlparser2#performance)
- support custom self-closing tags
- support HTML entities
- remove extra trailing newline for `<template>`
- distinguish empty/empty-string attributes (`<tag x>`/`<tag x="">`)
- rename `--parser parse5` with `--parser html`
- enable `html` since 1.15, which means it's enabled by default if you install the dev version from GitHub after this PR merged.
2018-09-22 21:53:38 +08:00
Ika ebedd5b74a refactor(html): simplify/extract code (#5112)
- extract utilities
- use built-in hasPrettierIgnore
- simplify some functions
- remove dead code
2018-09-19 23:07:27 +08:00