Skip to content

Commit

Permalink
Replace Jekyll highlight tags with fenced code blocks (#1412)
Browse files Browse the repository at this point in the history
* Replace Jekyll highlight tags with fenced code blocks

Replace Jekyll highlight tags with fenced code blocks.
Canonicalize javascript to js.
Correct highlighting languages.
Add highlighting to code blocks.
Remove leading $ from bash blocks.
Remove empty lines at start and end of code blocks.
Stripped trailing whitespace.

* Fix language of code highlighting
  • Loading branch information
juliusrickert committed Feb 17, 2022
1 parent 40bc395 commit 20dad35
Show file tree
Hide file tree
Showing 103 changed files with 632 additions and 586 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ Alternatively, on Mac you can install it using homebrew:

## Via [docker](https://hub.docker.com/r/stackexchange/dnscontrol/)

```
```bash
docker run --rm -it -v $(pwd)/dnsconfig.js:/dns/dnsconfig.js -v $(pwd)/creds.json:/dns/creds.json stackexchange/dnscontrol dnscontrol preview
```

The documentation can be viewed via Docker:

```
```bash
cd docs
docker run --rm -it --volume="$PWD:/srv/jekyll" --volume="$PWD/vendor/bundle:/usr/local/bundle" --env JEKYLL_ENV=production jekyll/jekyll:3.8 jekyll build -V
# Open docs/_site/index.html in your web browser to see the results.
Expand Down
9 changes: 4 additions & 5 deletions cmd/convertzone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ the OctoDNS provider), so why not use it?

Build the software and install in your personal bin:

```cmd
$ cd cmd/convertzone
$ go build
$ cp convertzone ~/bin/.
```bash
cd cmd/convertzone
go build
cp convertzone ~/bin/.
```


## Usage Overview

convertzone: Read and write DNS zone files.
Expand Down
6 changes: 3 additions & 3 deletions docs/_functions/domain/A.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ The address should be an ip address, either a string, or a numeric value obtaine
Modifiers can be any number of [record modifiers](#record-modifiers) or json objects, which will be merged into the record's metadata.

{% include startExample.html %}
{% highlight js %}

```js
D("example.com", REGISTRAR, DnsProvider("R53"),
A("@", "1.2.3.4"),
A("foo", "2.3.4.5"),
A("test.foo", IP("1.2.3.4"), TTL(5000)),
A("*", "1.2.3.4", {foo: 42})
);
```

{%endhighlight%}
{% include endExample.html %}
{% include endExample.html %}
6 changes: 3 additions & 3 deletions docs/_functions/domain/AAAA.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ The address should be an IPv6 address as a string.
Modifiers can be any number of [record modifiers](#record-modifiers) or json objects, which will be merged into the record's metadata.

{% include startExample.html %}
{% highlight js %}

```js
var addrV6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"

D("example.com", REGISTRAR, DnsProvider("R53"),
Expand All @@ -23,6 +23,6 @@ D("example.com", REGISTRAR, DnsProvider("R53"),
AAAA("test.foo", addrV6, TTL(5000)),
AAAA("*", addrV6, {foo: 42})
);
```

{%endhighlight%}
{% include endExample.html %}
{% include endExample.html %}
6 changes: 3 additions & 3 deletions docs/_functions/domain/ALIAS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ The name should be the relative label for the domain.
Target should be a string representing the target. If it is a single label we will assume it is a relative name on the current domain. If it contains *any* dots, it should be a fully qualified domain name, ending with a `.`.

{% include startExample.html %}
{% highlight js %}

```js
D("example.com", REGISTRAR, DnsProvider("CLOUDFLARE"),
ALIAS("@", "google.com."), // example.com -> google.com
);
```

{%endhighlight%}
{% include endExample.html %}
{% include endExample.html %}
6 changes: 4 additions & 2 deletions docs/_functions/domain/AUTODNSSEC_ON.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ NOTE: No parenthesis should follow these keywords. That is, the
correct syntax is `AUTODNSSEC_ON` not `AUTODNSSEC_ON()`

{% include startExample.html %}
{% highlight js %}

```js
D("example.com", .... ,
AUTODNSSEC_ON, // Enable AutoDNSSEC.
A("@", "10.1.1.1")
Expand All @@ -28,7 +29,8 @@ D("insecure.com", .... ,
AUTODNSSEC_OFF, // Disable AutoDNSSEC.
A("@", "10.2.2.2")
);
{%endhighlight%}
```

{% include endExample.html %}

If neither `AUTODNSSEC_ON` or `AUTODNSSEC_OFF` is specified for a
Expand Down
12 changes: 6 additions & 6 deletions docs/_functions/domain/AZURE_ALIAS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Attempting to use AZURE_ALIAS on another provider than Azure will result in an e

The name should be the relative label for the domain.

The type can be any of the following:
The type can be any of the following:
* A
* AAAA
* CNAME
Expand All @@ -27,7 +27,7 @@ The Target can :

* Point to a public IP resource from a DNS `A/AAAA` record set.
You can create an A/AAAA record set and make it an alias record set to point to a public IP resource (standard or basic).
The DNS record set changes automatically if the public IP address changes or is deleted.
The DNS record set changes automatically if the public IP address changes or is deleted.
Dangling DNS records that point to incorrect IP addresses are avoided.
There is a current limit of 20 alias records sets per resource.
* Point to a Traffic Manager profile from a DNS `A/AAAA/CNAME` record set.
Expand All @@ -39,16 +39,16 @@ You can create an alias record set of type A/AAAA for contoso.com (the zone apex
This is useful when you create static websites using Azure storage and Azure CDN.
* Point to another DNS record set within the same zone.
Alias records can reference other record sets of the same type.
For example, a DNS CNAME record set can be an alias to another CNAME record set.
For example, a DNS CNAME record set can be an alias to another CNAME record set.
This arrangement is useful if you want some record sets to be aliases and some non-aliases.

{% include startExample.html %}
{% highlight js %}

```js
D("example.com", REGISTRAR, DnsProvider("AZURE_DNS"),
AZURE_ALIAS("foo", "A", "/subscriptions/726f8cd6-6459-4db4-8e6d-2cd2716904e2/resourceGroups/test/providers/Microsoft.Network/trafficManagerProfiles/testpp2"), // record for traffic manager
AZURE_ALIAS("foo", "CNAME", "/subscriptions/726f8cd6-6459-4db4-8e6d-2cd2716904e2/resourceGroups/test/providers/Microsoft.Network/dnszones/example.com/A/quux."), // record in the same zone
);
```

{%endhighlight%}
{% include endExample.html %}
{% include endExample.html %}
4 changes: 2 additions & 2 deletions docs/_functions/domain/CAA.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Flags are controlled by modifier:
CAA record is supported only by BIND, Google Cloud DNS, Amazon Route 53 and OVH. Some certificate authorities may not support this record until the mandatory date of September 2017.

{% include startExample.html %}
{% highlight js %}

```js
D("example.com", REGISTRAR, DnsProvider("GCLOUD"),
// Allow letsencrypt to issue certificate for this domain
CAA("@", "issue", "letsencrypt.org"),
Expand All @@ -31,6 +31,6 @@ D("example.com", REGISTRAR, DnsProvider("GCLOUD"),
// this record then refuse to issue any certificate
CAA("@", "iodef", "mailto:test@example.com", CAA_CRITICAL)
);
```

{%endhighlight%}
{% include endExample.html %}
6 changes: 4 additions & 2 deletions docs/_functions/domain/CF_REDIRECT.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ only after sufficient time has elapsed to prove this is what you really want.
This example redirects the bare (aka apex, or naked) domain to www:

{% include startExample.html %}
{% highlight js %}

```js
D("foo.com", .... ,
CF_REDIRECT("mydomain.com/*", "https://www.mydomain.com/$1"),
);
{%endhighlight%}
```

{% include endExample.html %}
6 changes: 4 additions & 2 deletions docs/_functions/domain/CF_TEMP_REDIRECT.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ backups and manually verifying `dnscontrol preview` output before running
managed by DNSControl and those that aren't.

{% include startExample.html %}
{% highlight js %}

```js
D("foo.com", .... ,
CF_TEMP_REDIRECT("example.mydomain.com/*", "https://otherplace.yourdomain.com/$1"),
);
{%endhighlight%}
```

{% include endExample.html %}
10 changes: 6 additions & 4 deletions docs/_functions/domain/CF_WORKER_ROUTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ parameters:
- script
---

`CF_WORKER_ROUTE` uses the [Cloudflare Workers](https://developers.cloudflare.com/workers/)
`CF_WORKER_ROUTE` uses the [Cloudflare Workers](https://developers.cloudflare.com/workers/)
API to manage [worker routes](https://developers.cloudflare.com/workers/platform/routes)
for a given domain.

If _any_ `CF_WORKER_ROUTE` function is used then `dnscontrol` will manage _all_
If _any_ `CF_WORKER_ROUTE` function is used then `dnscontrol` will manage _all_
Worker Routes for the domain. To be clear: this means it will delete existing routes that
were created outside of DNSControl.

Expand All @@ -20,10 +20,12 @@ backups and manually verifying `dnscontrol preview` output before running
This example assigns the patterns `api.foo.com/*` and `foo.com/api/*` to a `my-worker` script:

{% include startExample.html %}
{% highlight js %}

```js
D("foo.com", .... ,
CF_WORKER_ROUTE("api.foo.com/*", "my-worker"),
CF_WORKER_ROUTE("foo.com/api/*", "my-worker"),
);
{%endhighlight%}
```

{% include endExample.html %}
4 changes: 2 additions & 2 deletions docs/_functions/domain/CNAME.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Using `@` or `*` for CNAME records is not recommended, as different providers su
Target should be a string representing the CNAME target. If it is a single label we will assume it is a relative name on the current domain. If it contains *any* dots, it should be a fully qualified domain name, ending with a `.`.

{% include startExample.html %}
{% highlight js %}

```js
D("example.com", REGISTRAR, DnsProvider("R53"),
CNAME("foo", "google.com."), // foo.example.com -> google.com
CNAME("abc", "@"), // abc.example.com -> example.com
CNAME("def", "test"), // def.example.com -> test.example.com
);
```

{%endhighlight%}
{% include endExample.html %}
6 changes: 3 additions & 3 deletions docs/_functions/domain/DS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Digest Type must be a number.
Digest must be a string.

{% include startExample.html %}
{% highlight js %}

```js
D("example.com", REGISTRAR, DnsProvider(R53),
DS("example.com", 2371, 13, 2, "ABCDEF")
);
```

{%endhighlight%}
{% include endExample.html %}
{% include endExample.html %}
4 changes: 2 additions & 2 deletions docs/_functions/domain/DefaultTTL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ DefaultTTL sets the TTL for all records in a domain that do not explicitly set o
it will use the DNSControl global default of 300 seconds.

{% include startExample.html %}
{% highlight js %}

```js
D('example.com', REGISTRAR, DnsProvider('R53'),
DefaultTTL("4h"),
A('@','1.2.3.4'), // uses default
A('foo', '2.3.4.5', TTL(600)) // overrides default
);
{%endhighlight%}
```

The DefaultTTL duration is the same format as [TTL](#TTL), an integer number of seconds
or a string with a unit such as `'4d'`.
Expand Down
6 changes: 4 additions & 2 deletions docs/_functions/domain/IGNORE_NAME.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ Technically `IGNORE_NAME` is a promise that DNSControl will not add, change, or
In this example, DNSControl will insert/update the "baz.example.com" record but will leave unchanged the "foo.example.com" and "bar.example.com" ones.

{% include startExample.html %}
{% highlight js %}

```js
D("example.com",
`IGNORE_NAME`("foo"),
`IGNORE_NAME`("bar"),
A("baz", "1.2.3.4")
);
{%endhighlight%}
```

{% include endExample.html %}

`IGNORE_NAME` also supports glob patterns in the style of the [gobwas/glob](https://github.com/gobwas/glob) library. All of
Expand Down
6 changes: 4 additions & 2 deletions docs/_functions/domain/IGNORE_TARGET.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ IGNORE_TARGET is generally used in very specific situations:
In this example, DNSControl will insert/update the "baz.example.com" record but will leave unchanged a CNAME to "foo.acm-validations.aws" record.

{% include startExample.html %}
{% highlight js %}

```js
D("example.com",
IGNORE_TARGET('**.acm-validations.aws.', 'CNAME'),
A("baz", "1.2.3.4")
);
{%endhighlight%}
```

{% include endExample.html %}

IGNORE_TARGET also supports glob patterns in the style of the [gobwas/glob](https://github.com/gobwas/glob#example) library. Some example patterns:
Expand Down
8 changes: 4 additions & 4 deletions docs/_functions/domain/IMPORT_TRANSFORM.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ be very error prone. Therefore instead you maintain foo.com and
let `IMPORT_TRANSFORM` automatically generate bar.com.

{% include startExample.html %}
{% highlight html %}

```text
foo.com:
one.foo.com. IN A 1.2.3.1
two.foo.com. IN A 1.2.3.2
Expand All @@ -38,15 +38,15 @@ bar.com:
two.foo.com.bar.com. IN A 1.2.3.2
three.foo.com.bar.com. IN A 123.123.123.113
four.foo.com.bar.com. IN A 123.123.123.114
```

{%endhighlight%}
{% include endExample.html %}

Here's how you'd implement this in DNSControl:

{% include startExample.html %}
{% highlight js %}

```js
var TRANSFORM_INT = [
// RANGE_START, RANGE_END, NEW_BASE
{ low: "1.2.3.10", high: "1.2.3.20", newBase: "123.123.123.100" }, // .10 to .20 rewritten as 123.123.123.100+IP
Expand All @@ -64,8 +64,8 @@ D("bar.com", .... ,
A("www","123.123.123.123")
IMPORT_TRANSFORM(TRANSFORM_INT, 'foo.com', 300),
);
```

{%endhighlight%}
{% include endExample.html %}

Transform rules are: RANGE_START, RANGE_END, NEW_BASE. NEW_BASE may be:
Expand Down
4 changes: 2 additions & 2 deletions docs/_functions/domain/INCLUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Includes all records from a given domain


{% include startExample.html %}
{% highlight js %}

```js
D("example.com!external", REGISTRAR, DnsProvider(R53),
A("test", "8.8.8.8")
);
Expand All @@ -18,6 +18,6 @@ D("example.com!internal", REGISTRAR, DnsProvider(R53),
INCLUDE("example.com!external"),
A("home", "127.0.0.1")
);
```

{%endhighlight%}
{% include endExample.html %}
6 changes: 3 additions & 3 deletions docs/_functions/domain/MX.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ Priority should be a number.
Target should be a string representing the MX target. If it is a single label we will assume it is a relative name on the current domain. If it contains *any* dots, it should be a fully qualified domain name, ending with a `.`.

{% include startExample.html %}
{% highlight js %}

```js
D("example.com", REGISTRAR, DnsProvider(R53),
MX("@", 5, "mail"), // mx example.com -> mail.example.com
MX("sub", 10, "mail.foo.com.")
);
```

{%endhighlight%}
{% include endExample.html %}
{% include endExample.html %}
Loading

0 comments on commit 20dad35

Please sign in to comment.