From feed1e1bed230562a9012edcf3d1fc4cfc707ad5 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 23 Dec 2019 12:05:47 -0800 Subject: [PATCH 1/2] doc: allow in header elements Allow use of in header elements without styling side effects. We can add styling later if desired. The goal here is to allow code to be set off in markdown without needing to escape characters and do lint exceptions for terms. This is probably a win in terms of accessibility too although it would be moreso if we had some visual differentiation for inside of headers. As mentioned above, that can always be added at a later time. PR-URL: https://github.com/nodejs/node/pull/31086 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- doc/api_assets/style.css | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index bdef22b04f78c9..ecb9208135db48 100644 --- a/doc/api_assets/style.css +++ b/doc/api_assets/style.css @@ -20,18 +20,28 @@ body { background: #fff; } -h1 { font-size: 2.5rem } -h2 { font-size: 2rem } -h3 { font-size: 1.75rem } -h4 { font-size: 1.5rem } -h5 { font-size: 1.25rem } -h6 { font-size: 1rem } - -h1, h2, h3, h4, h5, h6 { - margin: 1.5rem 0 1rem; - text-rendering: optimizeLegibility; +h1, h1 code { font-size: 2.5rem; } +h2, h2 code { font-size: 2rem; } +h3, h3 code { font-size: 1.75rem; } +h4, h4 code { font-size: 1.5rem; } +h5, h5 code { font-size: 1.25rem; } +h6, h6 code { font-size: 1rem; } + +h1, h1 code, +h2, h2 code, +h3, h3 code, +h4, h4 code, +h5, h5 code, +h6, h6 code { + background-color: inherit; + color: inherit; + font-family: inherit; font-weight: 700; + line-height: inherit; + margin: 1.5rem 0 1rem; + padding: inherit; position: relative; + text-rendering: optimizeLegibility; } pre, tt, code, .pre, span.type, a.type { From 52b9d559c225298a97f0fe900ca5400248a06f14 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 23 Dec 2019 12:07:51 -0800 Subject: [PATCH 2/2] doc,dns: use code markup/markdown in headers This will allow us to lint for use of `hostname` in prose without flagging `hostname` in code within headers. This also allows us to remove backslash escaping for `[` and `]` inside of header code, which makes the bare markdown more readable. PR-URL: https://github.com/nodejs/node/pull/31086 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- doc/api/dns.md | 74 +++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/doc/api/dns.md b/doc/api/dns.md index a4e83ee9712e0c..7eb178e328f766 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -56,7 +56,7 @@ dns.resolve4('archive.org', (err, addresses) => { There are subtle consequences in choosing one over the other, please consult the [Implementation considerations section][] for more information. -## Class: dns.Resolver +## Class: `dns.Resolver` @@ -97,7 +97,7 @@ The following methods from the `dns` module are available: * [`resolver.reverse()`][`dns.reverse()`] * [`resolver.setServers()`][`dns.setServers()`] -### resolver.cancel() +### `resolver.cancel()` @@ -105,7 +105,7 @@ added: v8.3.0 Cancel all outstanding DNS queries made by this resolver. The corresponding callbacks will be called with an error with code `ECANCELLED`. -## dns.getServers() +## `dns.getServers()` @@ -126,7 +126,7 @@ section if a custom port is used. ] ``` -## dns.lookup(hostname[, options], callback) +## `dns.lookup(hostname[, options], callback)` @@ -243,7 +243,7 @@ dns.lookupService('127.0.0.1', 22, (err, hostname, service) => { If this method is invoked as its [`util.promisify()`][]ed version, it returns a `Promise` for an `Object` with `hostname` and `service` properties. -## dns.resolve(hostname[, rrtype], callback) +## `dns.resolve(hostname[, rrtype], callback)` @@ -275,7 +275,7 @@ records. The type and structure of individual results varies based on `rrtype`: On error, `err` is an [`Error`][] object, where `err.code` is one of the [DNS error codes](#dns_error_codes). -## dns.resolve4(hostname[, options], callback) +## `dns.resolve4(hostname[, options], callback)` @@ -385,7 +385,7 @@ Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`). -## dns.resolveMx(hostname, callback) +## `dns.resolveMx(hostname, callback)` @@ -399,7 +399,7 @@ Uses the DNS protocol to resolve mail exchange records (`MX` records) for the contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`). -## dns.resolveNaptr(hostname, callback) +## `dns.resolveNaptr(hostname, callback)` @@ -431,7 +431,7 @@ function will contain an array of objects with the following properties: } ``` -## dns.resolveNs(hostname, callback) +## `dns.resolveNs(hostname, callback)` @@ -445,7 +445,7 @@ Uses the DNS protocol to resolve name server records (`NS` records) for the contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`). -## dns.resolvePtr(hostname, callback) +## `dns.resolvePtr(hostname, callback)` @@ -458,7 +458,7 @@ Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will be an array of strings containing the reply records. -## dns.resolveSoa(hostname, callback) +## `dns.resolveSoa(hostname, callback)` @@ -492,7 +492,7 @@ be an object with the following properties: } ``` -## dns.resolveSrv(hostname, callback) +## `dns.resolveSrv(hostname, callback)` @@ -520,7 +520,7 @@ be an array of objects with the following properties: } ``` -## dns.resolveTxt(hostname, callback) +## `dns.resolveTxt(hostname, callback)` @@ -536,7 +536,7 @@ two-dimensional array of the text records available for `hostname` (e.g. one record. Depending on the use case, these could be either joined together or treated separately. -## dns.reverse(ip, callback) +## `dns.reverse(ip, callback)` @@ -551,7 +551,7 @@ array of hostnames. On error, `err` is an [`Error`][] object, where `err.code` is one of the [DNS error codes][]. -## dns.setServers(servers) +## `dns.setServers(servers)` @@ -594,7 +594,7 @@ The `dns.promises` API provides an alternative set of asynchronous DNS methods that return `Promise` objects rather than using callbacks. The API is accessible via `require('dns').promises`. -### Class: dnsPromises.Resolver +### Class: `dnsPromises.Resolver` @@ -640,7 +640,7 @@ The following methods from the `dnsPromises` API are available: * [`resolver.reverse()`][`dnsPromises.reverse()`] * [`resolver.setServers()`][`dnsPromises.setServers()`] -### dnsPromises.getServers() +### `dnsPromises.getServers()` @@ -661,7 +661,7 @@ section if a custom port is used. ] ``` -### dnsPromises.lookup(hostname[, options]) +### `dnsPromises.lookup(hostname[, options])` @@ -724,7 +724,7 @@ dnsPromises.lookup('example.com', options).then((result) => { }); ``` -### dnsPromises.lookupService(address, port) +### `dnsPromises.lookupService(address, port)` @@ -749,7 +749,7 @@ dnsPromises.lookupService('127.0.0.1', 22).then((result) => { }); ``` -### dnsPromises.resolve(hostname[, rrtype]) +### `dnsPromises.resolve(hostname[, rrtype])` @@ -778,7 +778,7 @@ based on `rrtype`: On error, the `Promise` is rejected with an [`Error`][] object, where `err.code` is one of the [DNS error codes](#dns_error_codes). -### dnsPromises.resolve4(hostname[, options]) +### `dnsPromises.resolve4(hostname[, options])` @@ -793,7 +793,7 @@ Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv4 addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`). -### dnsPromises.resolve6(hostname[, options]) +### `dnsPromises.resolve6(hostname[, options])` @@ -808,7 +808,7 @@ Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv6 addresses. -### dnsPromises.resolveAny(hostname) +### `dnsPromises.resolveAny(hostname)` @@ -852,7 +852,7 @@ Here is an example of the result object: minttl: 60 } ] ``` -### dnsPromises.resolveCname(hostname) +### `dnsPromises.resolveCname(hostname)` @@ -862,7 +862,7 @@ Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success, the `Promise` is resolved with an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`). -### dnsPromises.resolveMx(hostname) +### `dnsPromises.resolveMx(hostname)` @@ -873,7 +873,7 @@ Uses the DNS protocol to resolve mail exchange records (`MX` records) for the containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`). -### dnsPromises.resolveNaptr(hostname) +### `dnsPromises.resolveNaptr(hostname)` @@ -902,7 +902,7 @@ of objects with the following properties: } ``` -### dnsPromises.resolveNs(hostname) +### `dnsPromises.resolveNs(hostname)` @@ -913,7 +913,7 @@ Uses the DNS protocol to resolve name server records (`NS` records) for the records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`). -### dnsPromises.resolvePtr(hostname) +### `dnsPromises.resolvePtr(hostname)` @@ -923,7 +923,7 @@ Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. On success, the `Promise` is resolved with an array of strings containing the reply records. -### dnsPromises.resolveSoa(hostname) +### `dnsPromises.resolveSoa(hostname)` @@ -954,7 +954,7 @@ following properties: } ``` -### dnsPromises.resolveSrv(hostname) +### `dnsPromises.resolveSrv(hostname)` @@ -979,7 +979,7 @@ the following properties: } ``` -### dnsPromises.resolveTxt(hostname) +### `dnsPromises.resolveTxt(hostname)` @@ -992,7 +992,7 @@ of the text records available for `hostname` (e.g. one record. Depending on the use case, these could be either joined together or treated separately. -### dnsPromises.reverse(ip) +### `dnsPromises.reverse(ip)` @@ -1004,7 +1004,7 @@ array of hostnames. On error, the `Promise` is rejected with an [`Error`][] object, where `err.code` is one of the [DNS error codes](#dns_error_codes). -### dnsPromises.setServers(servers) +### `dnsPromises.setServers(servers)`