highlight.js icon indicating copy to clipboard operation
highlight.js copied to clipboard

edit DNS grammar

Open Checconio opened this issue 2 years ago • 15 comments

add support for character strings and modification of DNS registration type recognition

Changes

add { // Character strings scope: 'string', begin: '"', end: '"' }, { className: 'type', begin: /IN|CH/ }

edit KEYWORDS

Checklist

  • [ X] Added markup tests, or they don't apply here because...
  • [ X] Updated the changelog at CHANGES.md

Checconio avatar Apr 26 '23 20:04 Checconio

Please show us an example of this syntax in an actual DNS file. Any how did we decide IN and CH are types?

joshgoebel avatar Apr 27 '23 02:04 joshgoebel

Hello,

The current syntax detects comments in values that are strings, which is a bug.

Here is the overview of the current syntax actualdns

In my syntax I add support for character strings to fix the comment bug in DNS values

In the current file, the keywords are the DNS record names, which is not the case for the "IN" and "CH" values which correspond to the class of the DNS record. That's why I wanted to separate them.

Here is the result of my changes newdns

Checconio avatar Apr 27 '23 08:04 Checconio

In my syntax I add support for character strings to fix the comment bug in DNS values

Yep. Nice. If you wanted to push further why not highlight everything following TXT as a string, quoted or not? This would prevent the other false positives we are seeing of random highlighting inside those strings.

In the current file, the keywords are the DNS record names, which is not the case for the "IN" and "CH" values which correspond to the class of the DNS record.

Makes sense.

Scoping () as punctuation might be nice as well.

joshgoebel avatar Apr 28 '23 01:04 joshgoebel

I made the corrections and we now have a file that looks good :) dns

Checconio avatar Apr 28 '23 10:04 Checconio

Please provide your test content here in textual form.

joshgoebel avatar Apr 29 '23 15:04 joshgoebel

Please provide your test content here in textual form.

;
; BIND data file for local loopback interface
;
$TTL    3600
$ORIGIN checconio.fr.
$INCLUDE "Kchecconio.fr.zsk.key"
$INCLUDE "Kchecconio.fr.ksk.key"

@       IN      SOA     server.dorianchecconi.fr. root.dorianchecconi.fr. (
                        2023040124      ; Serial
                        1200            ; Refresh
                        120             ; Retry
                        604800          ; Expire
                        3600 )  ; Negative Cache TTL

@               IN      NS      server.dorianchecconi.fr.

@               IN      CAA     0       issue   "letsencrypt.org"

@               IN      MX      10      server.dorianchecconi.fr.

@               IN      TXT     google-site-verification=aU4dDNsp6XuXfh2-3cTTU4
@               IN      TXT     brave-ledger-verification=807e569d632d84c67b73c1847321ce63c6f35be9a1ca
@               IN      TXT     "v=spf1 a mx ip4:80.31.156.3 ~all"
_dmarc          IN      TXT     "v=DMARC1;p=reject;pct=100;ruf=mailto:[email protected];rua=mailto:[email protected];sp=reject;adkim=s;aspf=s;rf=afrf;fo=1"
_domainkey      IN      TXT     "o=-; [email protected]"
mail._domainkey IN      TXT     ( "v=DKIM1; h=sha256; k=rsa; ""p=MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICoeVFwlbm1MB3ax4vQTB9Sk0llRKIuWxuidRG/h74PdwNf3iSyA9UxeRZPR0qZOChSoWvXQKGAyWmwrRQQoqmzUTp9xaHPra6+ds+quSvzWLZBLI3iulGu1X6QcehfTNfsnJkCLIxnxh""sm8AME8WzmxVL48xQSx6BhrOh6iz1U9EEPB0+5q5aV0iY0VvzJsm0fcTZ9GtVGoJCzcVORZgedY5R7WYeVkEDecX8teAiFNZihigwfdN3XemBwcl2U+eGmUgqeeHSJaJ36ooKnnUq7zB+w4dHWmJYo7yN5VdPeDVyTE/KwB+PoRCNfhe2/VGfSso0jsi+azp5bBfj6EFYxcyDtaLeoDUjK+v/qqPH76MUjcvA9/P7J4UxoNZcaP3laszB9""G/s/krbY7em3qjKrdW4IAqlaEAb6H4KskR1W0rBz4RdjOmP6XsoygL2Z2Q7uglT4lpEJYWk12FuV7k3F0AiXtKdlMduCb2wQGsOlh2ZE4oaEqRvwJEPvZyI8wyEF3QN27buYbX6GnMC+X8x1TfzcUTnKxzZX2Q0X5b2JVaLEvmd+VipcA6FtLSfR8AFikzB9X/9EJxHYm4vc48kOLhhGlVsLbzw5Ygz09ScCAwEAAQ==" )
_smtp._tls              IN      TXT     "v=TLSRPTv1;rua=mailto:[email protected]"

;_autodiscover._tcp     IN      SRV     10      10      443 autodiscover.checconio.fr.

@               IN      A       80.31.156.3
autodiscover    IN      A       82.11.196.30

Checconio avatar Apr 30 '23 10:04 Checconio

test content

The test content is good ?

Checconio avatar May 07 '23 08:05 Checconio

joshgoebel Have you news for this change ?

Thank's

Checconio avatar May 24 '23 16:05 Checconio

Please pull down my latest commit and test. It tries to more accurately handle TXT records. You might have to -f since I rebased. If it looks good and you could make sure the tests are back in sync then I think this is good to ship.

joshgoebel avatar May 25 '23 04:05 joshgoebel

Please pull down my latest commit and test. It tries to more accurately handle TXT records. You might have to -f since I rebased. If it looks good and you could make sure the tests are back in sync then I think this is good to ship.

Thank you for these modifications I have just tested and confirm that everything is good!

Checconio avatar May 26 '23 10:05 Checconio

joshgoebel It's good for you ?

Checconio avatar Jun 23 '23 11:06 Checconio