Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
mdast-util-heading-range
Advanced tools
Markdown heading as ranges in mdast.
npm:
npm install mdast-util-heading-range
mdast-util-heading-range is also available for duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.
var heading = require('mdast-util-heading-range');
var remark = require('remark');
Process a document.
var doc = remark()
.use(function () {
return function (node) {
heading(node, 'foo', function (start, nodes, end) {
return [
start,
{
'type': 'paragraph',
'children': [
{
'type': 'text',
'value': 'Qux.'
}
]
},
end
];
});
}
}).process([
'# Foo',
'',
'Bar.',
'',
'# Baz',
''
].join('\n'));
Yields:
# Foo
Qux.
# Baz
heading(node, test, onrun)
Transform part of a document without affecting other parts, by changing a
section: a heading which passes test
, until the next heading of the same
or lower depth, or the end of the document.
Parameters
node
(Node
) — Node to search;
test
(string
, RegExp
, function(string, Node): boolean
)
— Heading to look for:
When string
, wrapped in
new RegExp('^(' + value + ')$', 'i')
;
Then, when RegExp
, wrapped in
function (value) {expression.test(value)}
.
onrun
(Array.<Node>? = function (start, nodes, end)
)
— Callback invoked when a range is found.
function onrun(start, nodes, end?, scope)
Parameters
start
(Heading
) — Start of range;
nodes
(Array.<Node>
) — Nodes between start
and end
;
end
(Heading?
) — End of range, if any.
scope
(Object
):
parent
(Node
) — Parent of the range;start
(number
) — Index of start
in parent
;end
(number?
) — Index of end
in parent
.Returns
Array.<Node>?
— Zero or more nodes to replace the range (including
start
, and end
) with.
FAQs
mdast utility to use headings as ranges in mdast
We found that mdast-util-heading-range demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.