Commit Graph

69 Commits (788bd7afcd61b77dc08cd496fa50e8e345a3bf1a)

Author SHA1 Message Date
fisker Cheung 24f161db56 Bump `eslint` (#6201) 2019-06-12 11:40:05 -03:00
Mykola Bilochub c95b81dd3d fix(markdown): correctly determine count of backticks in inline code (#6110) 2019-05-14 12:51:31 -03:00
陈帅 a9d2c41464 feat(markdown): do not align table contents if it exceeds the print width and `--prose-wrap never` is set (#5701)
Fixes #5651
2019-01-30 12:24:21 -05:00
Ika 1061be0702
fix(mdx): correctly recognize inline JSX (#5783) 2019-01-22 12:02:30 +08:00
Ika 63999c74eb
fix(mdx): handle inline html correctly (#5704) 2019-01-03 10:46:11 +08:00
Wei-Wei Wu 91c20f7fbe Rename "babylon" with "babel" (#5647) 2018-12-27 21:05:19 +08:00
Ika 952bc0cc03
fix: get rid of CRLF (#5494) 2018-12-08 18:28:29 +08:00
Ika 043a937de6
fix(markdown): do not trim content in inline-math (#5485) 2018-11-16 00:17:20 +08:00
Huáng Jùnliàng d86f39cb83 fix(markdown): add more category to CJK regex (#5480)
The following characters should be treated as CJK character

```
3099..309A    ; Hira Kana # Mn   [2] COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK..COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
309B..309C    ; Hira Kana # Sk   [2] KATAKANA-HIRAGANA VOICED SOUND MARK..KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
```

Here is the [playground link](https://deploy-preview-5402--prettier.netlify.com/playground/#N4Igxg9gdgLgprEAuEhqhkFkMhahnYeoZ2EaGdQZoZ1AzBkEyGVczcnco8gHSmcGkGQEwZTB7BkHuGQGQjAdgw9AgAyAHhmGBHhmGAnhkDWDIEH7QJ0OgJIZAG3KB1BlIACANoA3ALpbAz+nLAFhGA-50CaDIGiGQMoMgCwZAEP89A2Qxj3E99NeBIf8BBDHyA8QyAMQyA+gyAMgzCgABygDRBgCFuslyAVgyAkQzJrIDGDGGAQAzMzCAANCAQAA4wAJbQAM7IoACGAE6NEADuAApNCLUo9XoQFQAmRSAARo31YADWcDAAyqWTFVAA5sgwjQCucMUAFjAAtgA2AOq7FfDVi2Bwc90XFXoXAJ7I4NW1xcvVcI0w7RMVgd6sgAGb1I4-YoAK2qAA8AEITaazOb1A5wAAyyzgYIhUJAsLhc2WKyOcAAipsIPA8ZCdiBFo0fo03sDGlNBm0oCNSi0ficJqU3ny4Cy9Ljio04ABHTYVaUA+pAkFIcH04o-A4VdZbBnVUnkqk03Fq-EMmD1UYnIYwXbIABMxQ29QqR1JAGEIAdgW8oNBJSBNj8ACpWnrqgl85YwG2DO3IADsAAYAL6poA) to show that current `prettier` adds redundant whitespaces around the characters.

The testcase text are copied from [半濁点 - Wikipedia](https://ja.wikipedia.org/wiki/%E5%8D%8A%E6%BF%81%E7%82%B9) and [ヴ - Wikipedia](https://ja.wikipedia.org/wiki/%E3%83%B4) respectively.
2018-11-15 00:10:50 +08:00
Ika 2bb95d8924
fix(markdown): handle CRLF correctly (#5414) 2018-11-11 00:24:37 +08:00
Ika 4e7fca5047
fix(markdown): identify CJK correctly (#5402) 2018-11-10 01:00:58 +08:00
Ika 8cedb9d25e
fix(markdown): do not keep increasing backslashes for dollar sign (#5358) 2018-11-07 10:06:57 +08:00
Ika 514b6d3741 Bump Prettier dependency to 1.15.0 2018-11-07 09:12:25 +08:00
Ika bb5a116b4f
fix(markdown): preserve inline math style (#5220) 2018-10-10 09:46:58 +08:00
Ika a1545a835a
feat(markdown): preserve math (#5050)
- preserve inlineMath (`$inline$`) and blockMath:

  ```md
  $$
  block
  $$
  ```
- side effect: `$` always needs to be escaped.
2018-09-05 21:07:37 +08:00
Ika 50c9115632
feat: add printer.preprocess (#5041)
Sometimes we need to transform the ast to make it easier to print, but it's currently done in the parser (markdown and yaml), which leads the output ast harder to use for external users (custom parser), adding `printer.preprocess` can solve this issue.

And also this way we could move the trailing newline for json from `ast-to-doc.js` to `language-js`.
2018-09-03 23:27:50 +08:00
Ika 91206891cd
fix(markdown): do not add whitespaces between Latin and Hangul (#5040)
Based on https://github.com/prettier/prettier/issues/5028#issuecomment-417825085, it seems Korean text uses conventional space so we're not going to add whitespaces between Latin and Hangul.
2018-09-02 16:20:22 +08:00
Ika 165742014a
fix(markdown): preserve leading/trailing newlines in fenced code block (#5038) 2018-09-01 13:35:29 +08:00
Ika 4ce28d3ef4
fix(markdown): inline footnote def if there's only one 1-line paragraph (#5025) 2018-09-01 13:14:22 +08:00
Ika 669282e32a
fix(markdown): stably print lists in front of whitespace-only trailing newline (#5024) 2018-09-01 12:14:53 +08:00
Ika 58d34bb844
refactor: language extend (#4994) 2018-08-22 10:12:57 +08:00
Ika 1790211f76
feat: support MDX (#4975)
* feat: support MDX

* refactor: flip condition
2018-08-13 22:23:09 +08:00
Ika 556fb3e646
feat(markdown): only align lists if they're already aligned (#4893)
* feat(markdown): only align lists if they're already aligned

* fix: handle single item with multiple leading spaces

* fix: empty items are considered not aligned
2018-07-27 09:48:09 +08:00
Ika cd16ff27d7
fix(markdown): preserve entity for surrogate pair (#4832) 2018-07-12 21:42:39 +08:00
Ika 2271992446
feat(json): add jsonc to aliases and use it to find parser in markdown embed (#4734) 2018-07-07 20:46:34 +08:00
Ika 432c9d7d04
feat(yaml): support proseWrap (#4742)
- support `proseWrap` in `yaml`
- move `proseWrap` to `commonOptions`
- update to `yaml@1.0.0-rc.4` and `yaml-unist-parser@1.0.0-rc.1`
2018-07-04 00:28:47 +08:00
Ika 99c4e41fa1
feat: format yaml front matter (#4773)
* refactor: front-matter

* feat: format yaml front matter
2018-07-03 09:54:40 +08:00
Alexander Kachkaev a05fd118be Do not require space after markdown block language name (#4783)
https://github.com/prettier/prettier/pull/4153 made it possible to detect fenced code block language when it is followed by arguments (e.g. ` ```js {something=something} `). This PR makes it also possible to detect language in cases cases like ` ```js{something=something} ` (no space).

The reason for this change is that Atom highlights code blocks regardless of a space after the language name, which makes users wonder why the correctly detected code block is not being formatted:

<img width="324" alt="screen shot 2018-06-28 at 22 08 13" src="https://user-images.githubusercontent.com/608862/42060780-db11f5b6-7b1f-11e8-9f43-fe91843f7d89.png">

PR background: https://github.com/prettier/prettier/pull/4153#issuecomment-401174999
2018-07-02 08:22:56 +08:00
Ika 0b659b898d
feat: update linguist languages (#4741)
Context: https://github.com/prettier/prettier/pull/4734#issue-196702272

Languages should be easy to maintain now.
2018-06-28 08:24:02 +08:00
Ika b67fa907bd
fix(markdown): preserve email autolink (#4740)
```diff
 <hello@example.com>
 <mailto:hello@example.com>
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-<mailto:hello@example.com>
+<hello@example.com>
 <mailto:hello@example.com>
```
2018-06-27 08:36:51 +08:00
Ika 35a42bef24
fix(markdown): better handling for trailing spaces (#4593)
- preserve trailing spaces in html, excluding html comment
- `doc-printer` is now unrelated to `options.parser`
- fix some cases that two trailing spaces are mis-considered as `break`
2018-06-08 00:20:25 +08:00
Ika e74e6565b4
fix(markdown): respect blank line between block htmls (#4609)
Fixes #4605 

The AST here is actually two `html`s and it did follow the [CommonMark spec](https://spec.commonmark.org/0.28/#html-blocks), so I ended up with respecting the blank line between block `html`s.
2018-06-01 00:33:37 +08:00
Lucas Azzola b0cb63a7bb
Use destructuring for imports (#4554)
* Use destructuring for imports

* Clean up integration tests

* Use moduleNameMapper for require_prettier
2018-05-27 21:36:12 +10:00
Lucas Duailibe 52a2a46b3c
New build system (#4449) 2018-05-24 15:30:45 -03:00
Jed Fox 9155fe5018
Rename all uses of frontmatter to frontMatter or front-matter (#4519) 2018-05-21 10:02:09 -04:00
Ika a9eb68296c
fix(markdown): do not merge continuous cjk if proseWrap=preserve (#4504)
* test: add tests

* fix(markdown): do not merge continuous cjk if proseWrap=preserve

* fix: remove trailing comma for node4
2018-05-19 13:53:34 +08:00
Suchipi ec45dc9a4c
(refactor): Move common options out of JS plugin (#4445)
* (refactor): Move common options out of JS plugin

* Add Common category to playground
2018-05-15 14:14:50 -06:00
Lucas Duailibe 7bc5ec2dc6
Preserve Liquid tags contents (#4484) 2018-05-15 14:22:41 -03:00
Lucas Duailibe 983202413c
Refactor frontmatter handling (#4482) 2018-05-14 22:17:15 -03:00
Jed Fox dc68a3d9a6
Break link definitions onto multiple lines when needed (#3531)
* Break link definitions onto multiple lines when needed

* Simplify the conditional for breaking the title

* Don’t print the title if it’s blank

* Revert "Don’t print the title if it’s blank"

This reverts commit 2a8d0dd9995a2e5ab8e6d888c07b88dda058637f.

* Add another test

* Fix title printing

* Second time’s the charm

* Third time’s the charm?

* Fix snapshot

* Prettify

* Don’t break unless `proseWrap` is `always`

* Test `proseWrap: never` on link references
2018-05-14 06:17:37 -04:00
Ika 6447d30b0b
feat(markdown): change unordered list symbol to hyphen (#4440) 2018-05-10 14:32:52 +08:00
Ika df3eb0cf68
refactor(massageAst): move target props to corresponding plugins (#4430) 2018-05-08 10:48:29 +08:00
Huy Vo 2ad7576d3a Remove newline in empty .md files (#4388)
* Remove newline in empty .md files

* Fix cannot read property 'type' of undefined bug
2018-04-27 15:01:14 +08:00
Lucas Duailibe 67f1c4877e
Refactoring: better boundaries for different parts of the project (#4364) 2018-04-25 13:29:35 -03:00
Ika 1f84880fb1
refactor: remove duplicate mapDoc (#4310) 2018-04-15 00:07:03 +08:00
Ika c814a9fa4d
fix(markdown): null check for code.lang (#4307) 2018-04-13 17:50:33 +08:00
Suchipi Izumi bdc5e0073d Bump own prettier dependency to 1.12.0 2018-04-11 22:39:13 -06:00
Ika 0c1d62079e
feat(markdown): support hasPragma/insertPragma (#4275)
* feat(markdown): support hasPragma/insertPragma

* test: add require-pragma tests

* feat: support pragma with front matter

* feat: support pragma in multiline comment
2018-04-09 00:10:24 +08:00
Ika 4bc80d8c64
fix(markdown): remove unnecessary empty line in front matter (#4280)
* test: add tests

* fix(markdown): remove unnecessary empty line in front matter
2018-04-08 00:05:27 +08:00
Ika 01e8e2bb8a
refactor(markdown): use built-in ignore (#4274) 2018-04-07 00:19:26 +08:00