cucumber / gherkin-utils

API for working with Gherkin documents
MIT License
9 stars 4 forks source link

Formatter introduces escapes on standalone backslashes #77

Open kieran-ryan opened 2 months ago

kieran-ryan commented 2 months ago

👓 What did you see?

Formatting escaped_pipes.feature in the gherkin parser's test data, the following diff is produced; with escapes introduced for standalone backslashes.

-       | \|æ\\n     | \o\no\ |
+       | \|æ\\n     | \\o\no\\ |

✅ What did you expect to see?

New escape characters are not introduced.

       | \|æ\\n     | \o\no\ |

📦 Which tool/library version are you using?

node v18.16.0 gherkin-utils v9.0.0

🔬 How could we reproduce it?

Run the following in the gherkin parser repository

npm install @cucumber/gherkin-utils
npx @cucumber/gherkin-utils format gherkin/testdata/good/escaped_pipes.feature

📚 Any additional context?

Unsure of appropriate behaviour in this case; and whether is desirable to be introducing these characters by the formatter. Perhaps is appropriate behaviour?

mpkorstanje commented 2 months ago

Is this caused by the formatter or does the parser render the double slashes?