Skip to content

Commit 3a0131a

Browse files
committed
doc: remove synopsis
1 parent 97dbb79 commit 3a0131a

File tree

6 files changed

+7
-133
lines changed

6 files changed

+7
-133
lines changed

doc/api/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<!--introduced_in=v0.10.0-->
77

88
* [About this documentation](documentation.md)
9-
* [Usage and example](synopsis.md)
109

1110
<hr class="line"/>
1211

doc/api/synopsis.md

Lines changed: 0 additions & 94 deletions
This file was deleted.

test/doctool/test-doctool-html.mjs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import assert from 'assert';
55
import { readFileSync } from 'fs';
66

77
import * as html from '../../tools/doc/html.mjs';
8-
import { replaceLinks } from '../../tools/doc/markdown.mjs';
8+
import replaceLinks from '../../tools/doc/markdown.mjs';
99
import {
1010
rehypeRaw,
1111
rehypeStringify,
@@ -14,22 +14,9 @@ import {
1414
unified,
1515
} from '../../tools/doc/deps.mjs';
1616

17-
// Test links mapper is an object of the following structure:
18-
// {
19-
// [filename]: {
20-
// [link definition identifier]: [url to the linked resource]
21-
// }
22-
// }
23-
const testLinksMapper = {
24-
'foo': {
25-
'command line options': 'cli.html#cli-options',
26-
'web server': 'example.html',
27-
},
28-
};
29-
3017
function toHTML({ input, filename, nodeVersion, versions }) {
3118
const content = unified()
32-
.use(replaceLinks, { filename, linksMapper: testLinksMapper })
19+
.use(replaceLinks)
3320
.use(remarkParse)
3421
.use(html.firstHeader)
3522
.use(html.preprocessText, { nodeVersion })
@@ -119,7 +106,7 @@ const testData = [
119106
'</a></h2><section><h3>Usage<span><a class="mark" href="#usage"' +
120107
'id="usage">#</a></span><a aria-hidden="true" class="legacy"' +
121108
'id="foo_usage"></a></h3><p><code>node \\[options\\] index.js' +
122-
'</code></p><p>Please see the<a href="cli.html#cli-options">' +
109+
'</code></p><p>Please see the<a href="cli.html#options">' +
123110
'Command Line Options</a>document for more information.</p>' +
124111
'</section><section><h3>' +
125112
'Example<span><a class="mark" href="#example" id="example">' +

tools/doc/generate.mjs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

22-
import { readFileSync, promises as fs } from 'fs';
22+
import { promises as fs } from 'fs';
2323
import path from 'path';
2424

2525
import raw from 'rehype-raw';
@@ -32,10 +32,7 @@ import { unified } from 'unified';
3232

3333
import * as html from './html.mjs';
3434
import * as json from './json.mjs';
35-
import { replaceLinks } from './markdown.mjs';
36-
37-
const linksMapperFile = new URL('links-mapper.json', import.meta.url);
38-
const linksMapper = JSON.parse(readFileSync(linksMapperFile, 'utf8'));
35+
import replaceLinks from './markdown.mjs';
3936

4037
// Parse the args.
4138
// Don't use nopt or whatever for this. It's simple enough.
@@ -84,7 +81,7 @@ async function main() {
8481

8582
const content = await unified()
8683
.use(frontmatter)
87-
.use(replaceLinks, { filename, linksMapper })
84+
.use(replaceLinks)
8885
.use(markdown)
8986
.use(gfm)
9087
.use(html.preprocessText, { nodeVersion })

tools/doc/links-mapper.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

tools/doc/markdown.mjs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,13 @@ import { visit } from 'unist-util-visit';
22

33
export const referenceToLocalMdFile = /^(?![+a-z]+:)([^#?]+)\.md(#.+)?$/i;
44

5-
export function replaceLinks({ filename, linksMapper }) {
5+
export default () => {
66
return (tree) => {
7-
const fileHtmlUrls = linksMapper[filename];
8-
97
visit(tree, (node) => {
108
node.url &&= node.url.replace(
119
referenceToLocalMdFile,
1210
(_, filename, hash) => `${filename}.html${hash || ''}`,
1311
);
1412
});
15-
visit(tree, 'definition', (node) => {
16-
const htmlUrl = fileHtmlUrls?.[node.identifier];
17-
18-
if (htmlUrl && typeof htmlUrl === 'string') {
19-
node.url = htmlUrl;
20-
}
21-
});
2213
};
2314
}

0 commit comments

Comments
 (0)