Open lowlighter opened 1 week ago
@g-plane could you please take a look? From what I can gather, indeed only single line ignores should be possible with deno-fmt-ignore
Ignoring a whole file is not supported at present, but I think this can be configured in deno.json
by adding files to "exclude"
. Are there any reasons that you can't use config file?
I'm testing xml/html cases where the formatting/spacing is actually revelant (things like xml:space="preserve"
, or local white-space
css property). A lot of libraries that optimize/transform xhtml usually honors the xml:space
, but since deno fmt
doesn't I figured out I'd test with the ignore instructions instead, but none of them seems to work (single-line, blocks and file). The only way is to use a <pre>
in html, but it'd also nullify the test too because of its special signifiance
```html
foo |
```diff
- foo +foo ``` |
I could register these files in the config as a work-around, but:
I don't mind if this is a temporary work-around, but I think in the long run 1 & 2 should definitely be addressed
Unlike Markdown, it's impossible to use ignore-start
and ignore-end
for HTML, but you can use deno-fmt-ignore
for a specific HTML element.
I have the same issue but for CSS. That might be better as a separate issue, but I tried both of the below options:
/* deno-fmt-ignore-file */
html {
/** deno-fmt-ignore-file */
html {
The docs only mention HTML, but if HTML ignore directives aren't working CSS may have the same root cause.
deno 2.0.0-rc.9 (release candidate, release, x86_64-unknown-linux-gnu) v8 12.9.202.13-rusty typescript 5.6.2
The docs suggest that you can bypass the fmt of html fileq but these instructions don't seem to work https://docs.deno.com/runtime/reference/cli/formatter/#markdown-%2F-html-%2F-css
Reproduction:
Current behavior:
Note that running in non-check mode does indeed change the file, so it's not an issue with the
--check
flag.I don't have an example but I think I've also tested the single line
<!-- deno-fmt-ignore -->
and it didn't work either.Also not sure if there is a typo in the docs or not (there is one instruction with
<!---
while others are<!--
which makes it a bit confusing):