
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
commonmark-helpers
Advanced tools
Even the strongest sometimes need help.
Basically, with commonmark-helpers you can find desire elements in markdown document and process them in html or plaintext format.
Bunch of helpers for working with commonmark. Also, you can be interested, why I created this module, that’s why I wrote a post about reasons.
Very important to notice, that this package is very simple and doesn’t contain any smart and/or complicated logic, that’s why it’s tightly coupled with commonmark API for AST tree. Check it out first.
npm install --save commonmark-helpers
var md = require('commonmark-helpers');
md.text(md.match('# title\n\ntext', md.isHeader)); // title
md.html(`*italic*`); // <p><em>italic</em></p>\n
md.text('**`plaintext`**'); // plaintext
function up(node) {
if (node.literal) {
node.literal = node.literal.toUpperCase();
}
};
md.text(md.matchProcess('# LOOK\n\nMA', up)); // LOOK\n\nMA
Look into tests for more examples.
Return html.
Type: string
/ AST
Return plain text.
Type: string
/ AST
Return AST tree for current text.
Type: string
Return first AST-node
matched my matcher in process of walking through AST-tree
. Returns undefined
if no one AST-node have been matched.
The most powerful method in this collection.
Type: string
/ AST
Type: function
. Receive: AST-node, event
In most cases you need only AST-node
to match on.
The same as match()
but remove first matched AST-node and return AST-tree without it.
Type: string
/ AST
Type: function
. Receive: AST-node, event
In most cases you need only AST-node
to match on.
The same as matchRemove()
but resulting AST-tree
after matcher1
passing to matcher2
, result of this to matcher3
and so on. Return AST-tree
without all the matched AST-nodes
.
Type: string
/ AST
Type: function
. Receive: AST-node, event
In most cases you need only AST-node
to match on.
Match and process AST-nodes
, return modified AST-tree.
Type: string
/ AST
Type: function
. Receive: AST-node, event
In most cases you need only AST-node
to match on and modify.
The same as matchProcess()
but resulting AST-tree
after processor1
passing to processor2
, result of this to processor3
and so on. Return AST-tree
is AST-tree
with all applied processors.
Type: string
/ AST
Type: function
. Receive: AST-node, event
In most cases you need only AST-node
to match on and modify.
const isType = (node, type) => node.type === type;
const isLevel = (node, level) => node.level === level;
const isText = node => isType(node, 'Text');
const isEmph = node => isType(node, 'Emph');
const isCode = node => isType(node, 'Code');
const isHtml = node => isType(node, 'Html');
const isLink = node => isType(node, 'Link');
const isItem = node => isType(node, 'Item');
const isList = node => isType(node, 'List');
const isImage = node => isType(node, 'Image');
const isStrong = node => isType(node, 'Strong');
const isHeader = node => isType(node, 'Header');
const isDocument = node => isType(node, 'Document');
const isCodeBlock = node => isType(node, 'CodeBlock');
const isHtmlBlock = node => isType(node, 'HtmlBlock');
const isSoftbreak = node => isType(node, 'Softbreak');
const isHardbreak = node => isType(node, 'Hardbreak');
const isParagraph = node => isType(node, 'Paragraph');
const isBlockQuote = node => isType(node, 'BlockQuote');
const isHorizontalRule = node => isType(node, 'HorizontalRule');
const isRoot = node => node.parent && isDocument(node.parent);
const isBreak = node => isHardbreak(node) || isSoftbreak(node);
MIT © Vladimir Starkov
FAQs
Helper methods for commonmark
We found that commonmark-helpers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.