Commit Graph

13 Commits (952bc0cc039c034c5fe651864db528dcd9800e9e)

Author SHA1 Message Date
Ika 952bc0cc03
fix: get rid of CRLF (#5494) 2018-12-08 18:28:29 +08:00
Ika ab7f46bf40
feat(yaml): preserve the first document head end marker (#5502) 2018-11-25 10:30:25 +08:00
Ika 514b6d3741 Bump Prettier dependency to 1.15.0 2018-11-07 09:12:25 +08:00
Ika 3056c5a5c0
fix(yaml): escape quotes correctly (#5236) 2018-10-11 14:31:18 +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 db2bc3636d
fix(yaml): update parsers (#5027)
- upgrade to `yaml@1.0.0-rc.8` and `yaml-unist-parser@1.0.0-rc.4`
- refactor some logic since the AST has slightly changed (ikatyang/yaml-unist-parser#82)
- unmatched aliases are now errors since it may introduce invalid AST from `yaml`
- rewrite the document separator (`...`/`---`) logic, this fixes some cases where it can use `---` but we printed `...`
- removed some unnecessary duplicate trailing newline
- trailing comments on `document` (`... #comment`) and `documentHead` (`--- #comment`) are preserved (i.e. they won't be moved somewhere)
2018-09-01 20:04:37 +08:00
Ika 6ba6138d09
feat(yaml): prefer implicit key for empty value (#4972)
* feat(yaml): prefer implicit key for empty value

* fix: prefer `?` for `!!set`

* refactor
2018-08-12 13:38:14 +08:00
Ika b6077e175e
fix(yaml): end comment in nested mapping (#4918)
* test: add tests

* fix(yaml): end comment in nested mapping
2018-08-02 22:38:16 +08:00
Ika 10df246772
feat(yaml): do not put singleline values on a separate line from the key (#4916)
Only apply to `alias` and `plain`/`quoteSingle`/`quoteDouble` with

- no backslash newline
- or no literal newline and `proseWrap: preserve`
- or no newline and `proseWrap: never`
- or no whitespace and `proseWrap: always`

in mapping items with implicit key, otherwise it's impossible to do prose wrapping.
2018-08-02 00:15:33 +08:00
Ika d83ca5a6c6 fix(yaml): prefer dash as document separator (#4921)
* test: add tests

* fix(yaml): prefer dash as document separator
2018-08-01 14:10:06 +10:00
Ika cb7fe00863
fix(yaml): support end comments (#4854) 2018-07-18 09:37:53 +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 dcf44ffbdc
feat: support YAML (#4563)
* feat: support YAML

* fix: do not indent sequence in mappingValue

* docs: add yaml to index.md

* fix: reduce `SyntaxError: Node#parse consumed no characters`

* chore: remove old-build and new-worker.js

* refactor

* refactor

* refactor

* refactor

* refactor

* refactor

* refactor

* refactor

* refactor

* refactor

* refactor

* refactor

* fix: no space after `<<`

* fix: add yaml to standalone test

* test: add tests

* fix: next empty line in flow collection

* fix: tabs are not allowed
http://yaml.org/spec/1.2/spec.html#space/indentation/

* fix: update parser

* feat: rewrite the mappingItem logic
* feat: indent sequence in mapping
* feat(doc): add ifBreak#groupId and group#id

* chore: fix node 4

* chore: add tools_yaml.svg

* chore: remove resolved TODO

* refactor: remove unnecessary workaround

* chore(worker): importScriptOnce

* chore(build): rename with babelPlugins

* make it rollup compatible

* feat: support singleQuote

* refactor
2018-06-21 10:29:42 +08:00