|
1 | 1 | # Prettier for XQuery |
2 | | -[](http://badge.fury.io/js/prettier-plugin-xquery) [](https://github.com/DrRataplan/prettier-plugin-xquery/actions/workflows/test.yml) [](https://coveralls.io/github/DrRataplan/prettier-plugin-xquery) |
| 2 | +[](http://badge.fury.io/js/prettier-plugin-xquery) |
| 4 | +[](https://github.com/DrRataplan/prettier-plugin-xquery/actions/workflows/test.yml) |
| 5 | +[](https://coveralls.io/github/DrRataplan/prettier-plugin-xquery) |
3 | 7 |
|
4 | | -`prettier-plugin-xquery` is a [prettier](https://prettier.io/) plugin for XQuery. `prettier` is an opinionated code formatter that supports multiple languages and integrates with most editors. The idea is to eliminate discussions of style in code review and allow developers to get back to thinking about code design instead. |
| 8 | +`prettier-plugin-xquery` is a [prettier](https://prettier.io/) plugin for XQuery. `prettier` is an |
| 9 | +opinionated code formatter that supports multiple languages and integrates with most editors. The |
| 10 | +idea is to eliminate discussions of style in code review and allow developers to get back to |
| 11 | +thinking about code design instead. |
5 | 12 |
|
6 | 13 | ## Demo |
7 | 14 | A demo page lives at [xquery.elliat.nl](https://xquery.elliat.nl). |
8 | 15 |
|
9 | 16 | ## Getting started |
10 | 17 |
|
11 | | -To run `prettier` with the XQuery plugin, you're going to need [`node`](https://nodejs.org/en/download/). |
| 18 | +To run `prettier` with the XQuery plugin, you're going to need |
| 19 | +[`node`](https://nodejs.org/en/download/). |
12 | 20 |
|
13 | 21 | If you're using the `npm` CLI, then add the plugin by: |
14 | 22 |
|
@@ -68,6 +76,31 @@ Or, they can be passed to `prettier` as arguments: |
68 | 76 | prettier --plugin=prettier-plugin-xquery --tab-width 4 --write '**/*.xq*' |
69 | 77 | ``` |
70 | 78 |
|
| 79 | +## Ignoring |
| 80 | + |
| 81 | +A `prettier-ignore` comment marks code as ignored for formatting. Like this: |
| 82 | + |
| 83 | +```xquery |
| 84 | +module namespace el = "http://www.elliat.nl"; |
| 85 | +
|
| 86 | +declare function el:reverse ( |
| 87 | + $a as xs:integer, |
| 88 | + $b as xs:integer, |
| 89 | + $c as xs:integer, |
| 90 | + $d as xs:integer |
| 91 | +) { |
| 92 | + ($d, $c, $b, $a) |
| 93 | +}; |
| 94 | +
|
| 95 | +(: prettier-ignore :) |
| 96 | +declare function el:swap ( |
| 97 | + $a as xs:integer, $b as xs:integer, |
| 98 | + $c as xs:integer, $b as xs:integer |
| 99 | +) { |
| 100 | + ($b, $a, $d, $c) |
| 101 | +}; |
| 102 | +``` |
| 103 | + |
71 | 104 | ## Contributing |
72 | 105 |
|
73 | 106 | Bug reports and pull requests are welcome on GitHub at |
|
0 commit comments