Skip to content

Commit

Permalink
Refactor comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed May 24, 2019
1 parent 92ff1e1 commit 41bdce4
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion lib/handlers/footnote.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ function footnote(h, node) {

identifier = String(identifier)

// No need to check if `identifier` exists, as it’s guaranteed to not exist.
// No need to check if `identifier` exists in `footnoteOrder`, it’s guaranteed
// to not exist because we just generated it.
footnoteOrder.push(identifier)

footnoteById[identifier] = {
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = html

var u = require('unist-builder')

// Return either a `raw` node, in dangerous mode, or nothing.
// Return either a `raw` node in dangerous mode, otherwise nothing.
function html(h, node) {
return h.dangerous ? h.augment(node, u('raw', node.value)) : null
}
2 changes: 1 addition & 1 deletion lib/handlers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
footnoteDefinition: ignore
}

// Return nothing for nodes which are ignored.
// Return nothing for nodes that are ignored.
function ignore() {
return null
}
3 changes: 2 additions & 1 deletion lib/handlers/list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function listItem(h, node, parent) {
var length
var child

/* Tight lists should not render 'paragraph' nodes as 'p' tags */
// Tight lists should not render `paragraph` nodes as `p` elements.
if (loose) {
result = raw
} else {
Expand Down Expand Up @@ -57,6 +57,7 @@ function listItem(h, node, parent) {
)

// According to github-markdown-css, this class hides bullet.
// See: <https://github.com/sindresorhus/github-markdown-css>.
props.className = ['task-list-item']
}

Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function list(h, node) {
items = all(h, node)
length = items.length

// Like GitHub, add a class for custom styling
// Like GitHub, add a class for custom styling.
while (++index < length) {
if (
items[index].properties.className &&
Expand Down
6 changes: 3 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function factory(tree, options) {
var data
var ctx

// Handle `data.hName`, `data.hProperties, `hChildren`.
// Handle `data.hName`, `data.hProperties, `data.hChildren`.
if (left && 'data' in left) {
data = left.data

Expand Down Expand Up @@ -65,7 +65,7 @@ function factory(tree, options) {
return right
}

// Create an element for a `node`.
// Create an element for `node`.
function h(node, tagName, props, children) {
if (
(children === undefined || children === null) &&
Expand All @@ -88,7 +88,7 @@ function factory(tree, options) {
var id = definition.identifier.toUpperCase()

// Mimick CM behavior of link definitions.
// https://github.com/syntax-tree/mdast-util-definitions/blob/8d48e57/index.js#L26
// See: <https://github.com/syntax-tree/mdast-util-definitions/blob/8d48e57/index.js#L26>.
if (!own.call(footnoteById, id)) {
footnoteById[id] = definition
}
Expand Down
2 changes: 1 addition & 1 deletion lib/one.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function one(h, node, parent) {
return (typeof fn === 'function' ? fn : unknown)(h, node, parent)
}

// Check if the node should be renderered a text node.
// Check if the node should be renderered as a text node.
function text(node) {
var data = node.data || {}

Expand Down
2 changes: 1 addition & 1 deletion lib/revert.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = revert
var u = require('unist-builder')
var all = require('./all')

// Return the content of a reference without definition as markdown.
// Return the content of a reference without definition as Markdown.
function revert(h, node) {
var subtype = node.referenceType
var suffix = ']'
Expand Down
4 changes: 2 additions & 2 deletions lib/wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module.exports = wrap

var u = require('unist-builder')

// Wrap `nodes` with newlines between each entry. Optionally adds newlines at
// the start and end.
// Wrap `nodes` with line feeds between each entry.
// Optionally adds line feeds at the start and end.
function wrap(nodes, loose) {
var result = []
var index = -1
Expand Down

0 comments on commit 41bdce4

Please sign in to comment.