Lines Matching +full:node +full:- +full:version
1 // Copyright Joyent, Inc. and other Node contributors.
26 import raw from 'rehype-raw';
27 import htmlStringify from 'rehype-stringify';
28 import gfm from 'remark-gfm';
29 import markdown from 'remark-parse';
30 import remark2rehype from 'remark-rehype';
32 import { visit } from 'unist-util-visit';
35 import * as typeParser from './type-parser.mjs';
47 visit(tree, { type: 'element', tagName: 'a' }, (node) => {
48 node.properties.class = 'nav-' +
49 node.properties.href.replace('.html', '').replace(/\W+/g, '-');
57 .replace(/^<!--.*?-->/gms, '');
78 content = content.replace(/(?<=<\/?h)[1-5](?=[^<>]*>)/g, (level) => ++level);
100 const id = filename.replace(/\W+/g, '-');
111 `class="nav-${id}"`, `class="nav-${id} active"`))
116 /<!--\s*introduced_in\s*=\s*v([0-9]+)\.([0-9]+)\.[0-9]+\s*-->/);
120 console.error(`Failed to add alternative version links to ${filename}`);
131 visit(tree, (node) => {
132 if (node.type === 'heading') {
133 heading = node;
139 const recursiveTextContent = (node) => argument
140 node.value || node.children.map(recursiveTextContent).join('');
148 // Handle general body-text replacements.
152 visit(tree, null, (node) => {
153 if (common.isSourceLink(node.value)) {
154 const [path] = node.value.match(/(?<=<!-- source_link=).*(?= -->)/);
155 …node.value = `<p><strong>Source Code:</strong> <a href="https://github.com/nodejs/node/blob/${node…
156 } else if (node.type === 'text' && node.value) {
157 const value = linkJsTypeDocs(linkManPages(node.value));
158 if (value !== node.value) {
159 node.type = 'html';
160 node.value = value;
169 const MAN_PAGE = /(^|\s)([a-z.]+)\((\d)([a-z]?)\)/gm;
173 // '<a href="http://man7.org/linux/man-pages/man2/open.2.html">open(2)</a>'.
185 …return `${beginning}<a href="http://man7.org/linux/man-pages/man${number}/${name}.${number}${optio…
207 const isJSFlavorSnippet = (node) => node.lang === 'cjs' || node.lang === 'mjs'; argument
213 let headingIndex = -1;
216 visit(tree, null, (node, index, parent) => {
217 if (node.type === 'heading') {
219 heading = node;
220 } else if (node.type === 'code') {
221 if (!node.lang) {
223 `No language set in ${filename}, line ${node.position.start.line}`,
226 const className = isJSFlavorSnippet(node) ?
227 `language-js ${node.lang}` :
228 `language-${node.lang}`;
231 …ode class='${className}'>${(getLanguage(node.lang || '') ? highlight(node.value, { language: node.…
232 node.type = 'html';
234 const copyButton = '<button class="copy-button">copy</button>';
236 if (isJSFlavorSnippet(node)) {
237 const previousNode = parent.children[index - 1] || {};
240 … const charCountFirstTwoLines = Math.max(...node.value.split('\n', 2).map((str) => str.length));
244 nextNode.lang !== node.lang) {
245 // Saving the highlight code as value to be added in the next node.
246 node.value = highlighted;
247 node.charCountFirstTwoLines = charCountFirstTwoLines;
249 previousNode.lang !== node.lang) {
252 node.value = `<pre class="with-${actualCharCount}-chars">` +
253 '<input class="js-flavor-selector" type="checkbox"' +
255 (node.lang === 'cjs' ? ' checked' : '') +
256 ' aria-label="Show modern ES modules syntax">' +
261 node.lang = null;
266 node.value = `<pre>${highlighted} ${copyButton}</pre>`;
269 node.value = `<pre>${highlighted} ${copyButton}</pre>`;
271 } else if (node.type === 'html' && common.isYAMLBlock(node.value)) {
272 node.value = parseYAML(node.value);
274 } else if (node.type === 'blockquote') {
275 const paragraph = node.children[0].type === 'paragraph' &&
276 node.children[0];
285 const isStabilityIndex = index - headingIndex <= 3;
289 headingIndex = -1;
297 // Collapse blockquote and paragraph into a single node
298 node.type = 'paragraph';
299 node.children.shift();
300 node.children.unshift(...paragraph.children);
303 node.children.unshift({
307 '<a href="documentation.html#stability-index">') +
316 node.children.push({ type: 'html', value: '</div>' });
332 added.version = meta.added;
333 added.description = `<span>Added in: ${added.version.join(', ')}</span>`;
337 deprecated.version = meta.deprecated;
339 `<span>Deprecated since: ${deprecated.version.join(', ')}</span>`;
343 removed.version = meta.removed;
344 removed.description = `<span>Removed in: ${removed.version.join(', ')}</span>`;
351 meta.changes.sort((a, b) => versionSort(a.version, b.version));
355 '<table>\n<tr><th>Version</th><th>Changes</th></tr>\n';
366 const version = common.arrify(change.version).join(', ');
368 result += `<tr><td>${version}</td>\n` +
378 result += `<span>N-API version: ${meta.napiVersion.join(', ')}</span>\n`;
399 return +b.match(numberRe)[0] - +a.match(numberRe)[0];
410 visit(tree, null, (node) => {
411 if (node.type !== 'heading') return;
413 if (node.depth - depth > 1) {
415 `Inappropriate heading level:\n${JSON.stringify(node)}`,
419 depth = node.depth;
422 node.children[0].position.start.offset,
423 node.position.end.offset).trim();
431 if (!node.data) node.data = {};
432 if (!node.data.hProperties) node.data.hProperties = {};
433 node.data.hProperties.id =
437 const hasStability = node.stability !== undefined;
438 toc += ' '.repeat((depth - 1) * 2) +
439 (hasStability ? `* <span class="stability_${node.stability}">` : '* ') +
440 …`<a href="#${isDeprecationHeading ? node.data.hProperties.id : id}">${headingText}</a>${hasStabili…
446 anchor += `<a aria-hidden="true" class="legacy" id="${legacyId}"></a>`;
458 node.children.push({ type: 'html', value: anchor });
473 file.toc = file.tocPicker = '<!-- TOC -->';
479 const punctuation = /[^\w\- ]/g;
483 .replace(/ /g, '-');
493 const notAlphaNumerics = /[^a-z0-9]+/g;
495 const notAlphaStart = /^[^a-z]/;
513 `${host}/docs/latest-v${versionNum}/api/${filename}.html`;
515 const wrapInListItem = (version) => argument
516 …`<li><a href="${getHref(version.num)}">${version.num}${version.lts ? ' <b>LTS</b>' : ''}</a></li>`;
518 function isDocInVersion(version) { argument
519 const [versionMajor, versionMinor] = version.num.split('.').map(Number);
529 <li class="picker-header">
531 <span class="collapsed-arrow">►</span><span class="expanded-arrow">▼</span>
534 <div class="picker"><ol id="alt-docs">${list}</ol></div>
540 …return `<li class="edit_on_github"><a href="https://github.com/nodejs/node/edit/main/doc/api/${fil…
550 `class="nav-${id}"`, `class="nav-${id} active"`,
559 <li class="picker-header">
561 <span class="collapsed-arrow">►</span><span class="expanded-arrow">▼</span>
576 <li class="picker-header">
578 <span class="collapsed-arrow">►</span><span class="expanded-arrow">▼</span>