Skip to content

Commit

Permalink
tools: update to mdast-util-to-hast v3.0.2
Browse files Browse the repository at this point in the history
See syntax-tree/mdast-util-to-hast#21

Note: I updated all of the tools/doc dependencies, not just this one,
and removed the previous workaround that was in place until this change
landed.

PR-URL: #22140
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
rubys authored and BethGriggs committed Apr 16, 2019
1 parent f0acdfd commit 700df16
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 58 deletions.
22 changes: 1 addition & 21 deletions tools/doc/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function linkJsTypeDocs(text) {

// Preprocess headers, stability blockquotes, and YAML blocks.
function preprocessElements({ filename }) {
return (tree, file) => {
return (tree) => {
const STABILITY_RE = /(.*:)\s*(\d)([\s\S]*)/;
let headingIndex = -1;
let heading = null;
Expand All @@ -170,26 +170,6 @@ function preprocessElements({ filename }) {
if (node.type === 'heading') {
headingIndex = index;
heading = node;

// Ensure optional API parameters are not treated as links by
// collapsing all of heading into a single text node.
if (heading.children.length > 1) {
const position = {
start: heading.children[0].position.start,
end: heading.position.end
};

heading.children = [{
type: 'text',
value: file.contents.slice(
position.start.offset, position.end.offset)
.replace('&lt;', '<')
.replace('&gt;', '>')
.replace(/\\(.{1})/g, '$1'),
position
}];
}

} else if (node.type === 'html' && common.isYAMLBlock(node.value)) {
node.value = parseYAML(node.value);

Expand Down
102 changes: 68 additions & 34 deletions tools/doc/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tools/doc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
"remark-html": "^7.0.0",
"remark-parse": "^5.0.0",
"remark-rehype": "^3.0.0",
"to-vfile": "^5.0.0",
"to-vfile": "^5.0.1",
"unified": "^7.0.0",
"unist-util-find": "^1.0.1",
"unist-util-select": "^1.5.0",
"unist-util-visit": "^1.3.1"
"unist-util-visit": "^1.4.0"
},
"devDependencies": {
"js-yaml": "^3.5.2"
"js-yaml": "^3.12.2"
},
"optionalDependencies": {},
"bin": "./generate.js"
Expand Down

0 comments on commit 700df16

Please sign in to comment.