Commit Graph

47 Commits (998f98aaded4c3b2b627578098c7f0c92cda7385)

Author SHA1 Message Date
JounQin 998f98aade fix: Adjacent JSX elements should be allowed in mdx (#6332)
* fix: adjacent JSX elements should be allowed in mdx

* chore: update CHANGELOG.unreleased.md for PR

* fix: adjacent JSX elements format issue of line

* fix: get html text from ast correctly

* fix: self closing issue

* fix: finally find out how to get original text from position

* chore: reset unnecessary changes

* fix: additional text after jsx should also be allowed

* fix: regression of empty text

* docs: add missing links

* fix linting...
2019-07-29 14:32:24 +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 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
Ika 2bb95d8924
fix(markdown): handle CRLF correctly (#5414) 2018-11-11 00:24:37 +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 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 99c4e41fa1
feat: format yaml front matter (#4773)
* refactor: front-matter

* feat: format yaml front matter
2018-07-03 09:54:40 +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
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
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
Ika 1f84880fb1
refactor: remove duplicate mapDoc (#4310) 2018-04-15 00:07:03 +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
Ika 1b09fde361
feat(markdown): support top-level `prettier-ignore-start/end` (#4202)
* test: add tests

* feat(markdown): support top-level `prettier-ignore-start/end`

* docs(ignore): add range ignore
2018-03-27 00:03:28 +08:00
Ika 836fd1ddcf
fix(markdown): correct html indentation (#4115)
* test: add test case

* fix(markdown): correct html indentation
2018-03-08 00:06:22 +08:00
Ika b6c27893cc
fix(markdown): list prefix alignment: count spaces from correct place (#4041)
* test: add tests

* fix(markdown): list prefix alignment: count spaces from correct place

* docs: codeblock -> code block
2018-02-26 08:53:09 +08:00
Ika ca81bef73e
fix(markdown): list prefix: no unnecessary trailing spaces (#4042)
* fix(markdown): list prefix: no unnecessary trailing spaces

* refactor
2018-02-26 08:52:49 +08:00
Ika c1107a86dd feat(markdown): respect tabWidth for list items (#3990)
* feat(markdown): respect tabWidth for list items

* test: ensure no regression for #3459
2018-02-24 19:13:02 +11:00
Christian Zosel fac08034e7 Split out location extraction into plugin config (#3777)
* Split out location extraction into plugin config

* Reduce set of exported function, rebase to current master

* Pass custom locStart/locEnd fn's directly to affected methods

* (wip) always use locStart/locEnd from plugin

* Convert graphql implementation

* Convert HTML implementation

* (wip) convert JS implementation

* Remove unused variables

* Continue conversion of JS implementation

* Replace "util.locStart" with direct call to "options.locStart"

* Remove util closure

* Add unit test for structure of shared util

* Fix linting error, simplify locStart/End implementations
2018-02-09 23:17:48 +11:00
Ika 47714f5d4b
feat(plugins): change external options to be plugin-level (#3924) 2018-02-09 00:06:38 +08:00
Ika b529c634d1
fix(markdown): print multiline content correctly in footnoteDefinition (#3787)
* fix(markdown): print multiline content correctly in footnoteDefinition

* refactor: replace `ifBreak(line)` with `softline`

* refactor: fix linting
2018-01-27 00:48:47 +08:00
Ika 3df7d60a7f feat(markdown): respect `tabWidth` for list indentation (#3694)
* test: add test case

* feat(markdown): respect `tabWidth` for list indentation

* test: add extreme `tabWidth` test case
2018-01-10 18:45:22 +11:00
Lucas Duailibe 157df6e3fd
Print imageReference with no alt in Markdown (#3643) 2018-01-03 13:54:53 -03:00
Ika 6c0dd74518 feat(support-info): add `options` field (#3433)
* refactor: rename supportTable with supportLanguages

* refactor: use `dedent`

* test: reduce unnecessary data

* feat(support-info): add `options` field

* add `showDeprecated` option
* add `showUnreleased` option

* test: snapshot diff

* fix(support): add missing `since`

* fix: add missing `category`

* refactor: use template tag

* fix: `trailingComma:true` should redirect to `trailingComma:es5`

* refactor: reorder parser

* refactor: fix linting

* refactor: move options

* refactor: move options to printers
2017-12-31 15:34:37 +11:00
Lucas Azzola a041914551
Extract cleanAST to language-specific files (#3610)
* Extract cleanAST to language-specific files

* Fix lint

* Fix clean-ast for vue and glimmer
2017-12-30 21:30:09 +11:00
Lucas Azzola 4c9d4061da
Prettier Plugin API (#3536)
* Move files around in preparation for refactor

* Update paths in build script

* Extract generic printing logic from the JavaScript printer

* Conform printer API

* Fixup decorator handling

* Fix multiparser

* Create plugin entry for markdown

* Create plugin entry for javascript/typescript

* Create plugin entry for html

* Create plugin entry for graphql

* Create plugin entry for css/less/scss

* Move JSON to JS plugin entry

* Integrate plugins into getSupportInfo()

* Move astFormat to parser definition

* Move util to common

* Implement parser loading

* remark -> mdast

* Rename cli/cli -> cli/index

* Rename builder -> doc package, fix printer resolution

* Fix doc shape assumption in CSS-in-JS logic

* Fix third-party.js prod resolution

* Fixup build-docs script

* Distribute multiparser code

* Remove requirement to forward options

* Flatten closure

* Remove debug directory

* Expose doc

* Add external plugins

* Pass options to loadPlugins

* Export getParsers

* Pin resolve version

* Use getSupportInfo in Markdown embed

* Document plugin API

* Update build-docs

* Add CLI for plugins

* Lint docs

* Fixup build.js

* Add vue language

* Fixup multiparser for vue

* Upgrade rollup and rollup-plugin-commonjs

* Fixup third-party build

* Change AST format in docs
2017-12-26 12:23:50 +11:00