• Home
  • Raw
  • Download

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';
44 visit(tree, { type: 'element', tagName: 'a' }, (node) => {
45 node.properties.class = 'nav-' +
46 node.properties.href.replace('.html', '').replace(/\W+/g, '-');
54 .replace(/^<!--.*?-->/gms, '');
75 content = content.replace(/(?<=<\/?h)[1-5](?=[^<>]*>)/g, (level) => ++level);
91 const id = filename.replace(/\W+/g, '-');
99 `class="nav-${id}"`, `class="nav-${id} active"`))
104 /<!--\s*introduced_in\s*=\s*v([0-9]+)\.([0-9]+)\.[0-9]+\s*-->/);
108 console.error(`Failed to add alternative version links to ${filename}`);
119 visit(tree, (node) => {
120 if (node.type === 'heading') {
121 heading = node;
127 const recursiveTextContent = (node) => argument
128 node.value || node.children.map(recursiveTextContent).join('');
136 // Handle general body-text replacements.
140 visit(tree, null, (node) => {
141 if (common.isSourceLink(node.value)) {
142 const [path] = node.value.match(/(?<=<!-- source_link=).*(?= -->)/);
143node.value = `<p><strong>Source Code:</strong> <a href="https://github.com/nodejs/node/blob/${node…
144 } else if (node.type === 'text' && node.value) {
145 const value = linkJsTypeDocs(linkManPages(node.value));
146 if (value !== node.value) {
147 node.type = 'html';
148 node.value = value;
157 const MAN_PAGE = /(^|\s)([a-z.]+)\((\d)([a-z]?)\)/gm;
161 // '<a href="http://man7.org/linux/man-pages/man2/open.2.html">open(2)</a>'.
173 …return `${beginning}<a href="http://man7.org/linux/man-pages/man${number}/${name}.${number}${optio…
195 const isJSFlavorSnippet = (node) => node.lang === 'cjs' || node.lang === 'mjs'; argument
201 let headingIndex = -1;
204 visit(tree, null, (node, index, parent) => {
205 if (node.type === 'heading') {
207 heading = node;
208 } else if (node.type === 'code') {
209 if (!node.lang) {
211 `No language set in ${filename}, line ${node.position.start.line}`
214 const className = isJSFlavorSnippet(node) ?
215 `language-js ${node.lang}` :
216 `language-${node.lang}`;
218 …ode class='${className}'>${(getLanguage(node.lang || '') ? highlight(node.value, { language: node.…
219 node.type = 'html';
221 if (isJSFlavorSnippet(node)) {
222 const previousNode = parent.children[index - 1] || {};
227 nextNode.lang !== node.lang) {
228 // Saving the highlight code as value to be added in the next node.
229 node.value = highlighted;
231 node.value = '<pre>' +
232 '<input class="js-flavor-selector" type="checkbox"' +
234 (node.lang === 'cjs' ? ' checked' : '') +
235 ' aria-label="Show modern ES modules syntax">' +
239 node.lang = null;
244 node.value = `<pre>${highlighted}</pre>`;
247 node.value = `<pre>${highlighted}</pre>`;
249 } else if (node.type === 'html' && common.isYAMLBlock(node.value)) {
250 node.value = parseYAML(node.value);
252 } else if (node.type === 'blockquote') {
253 const paragraph = node.children[0].type === 'paragraph' &&
254 node.children[0];
263 const isStabilityIndex = index - headingIndex <= 3;
267 headingIndex = -1;
275 // Collapse blockquote and paragraph into a single node
276 node.type = 'paragraph';
277 node.children.shift();
278 node.children.unshift(...paragraph.children);
281 node.children.unshift({
294 node.children.push({ type: 'html', value: '</div>' });
310 added.version = meta.added.join(', ');
311 added.description = `<span>Added in: ${added.version}</span>`;
315 deprecated.version = meta.deprecated.join(', ');
317 `<span>Deprecated since: ${deprecated.version}</span>`;
321 removed.version = meta.removed.join(', ');
322 removed.description = `<span>Removed in: ${removed.version}</span>`;
330 meta.changes.sort((a, b) => versionSort(a.version, b.version));
333 '<table>\n<tr><th>Version</th><th>Changes</th></tr>\n';
344 const version = common.arrify(change.version).join(', ');
346 result += `<tr><td>${version}</td>\n` +
356 result += `<span>N-API version: ${meta.napiVersion.join(', ')}</span>\n`;
377 return +b.match(numberRe)[0] - +a.match(numberRe)[0];
387 visit(tree, null, (node) => {
388 if (node.type !== 'heading') return;
390 if (node.depth - depth > 1) {
392 `Inappropriate heading level:\n${JSON.stringify(node)}`
396 depth = node.depth;
399 node.children[0].position.start.offset,
400 node.position.end.offset).trim();
406 if (!node.data) node.data = {};
407 if (!node.data.hProperties) node.data.hProperties = {};
408 node.data.hProperties.id =
412 const hasStability = node.stability !== undefined;
413 toc += ' '.repeat((depth - 1) * 2) +
414 (hasStability ? `* <span class="stability_${node.stability}">` : '* ') +
415 …`<a href="#${isDeprecationHeading ? node.data.hProperties.id : id}">${headingText}</a>${hasStabili…
430 node.children.push({ type: 'html', value: anchor });
444 file.toc = '<!-- TOC -->';
449 const notAlphaNumerics = /[^a-z0-9]+/g;
451 const notAlphaStart = /^[^a-z]/;
469 `${host}/docs/latest-v${versionNum}/api/${filename}.html`;
471 const wrapInListItem = (version) => argument
472 …`<li><a href="${getHref(version.num)}">${version.num}${version.lts ? ' <b>LTS</b>' : ''}</a></li>`;
474 function isDocInVersion(version) { argument
475 const [versionMajor, versionMinor] = version.num.split('.').map(Number);
485 <li class="version-picker">
486 <a href="#">View another version <span>&#x25bc;</span></a>
487 <ol class="version-picker">${list}</ol>
493 …return `<li class="edit_on_github"><a href="https://github.com/nodejs/node/edit/master/doc/api/${f…