
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
parse-html-comments
Advanced tools
Get html-formatted comments and some associated metadata from a string
npm install parse-html-comments
yarn add parse-html-comments
May be imported with ES6 import or Node require syntax.
import parseComments from 'parse-html-comments'
/* or */
const parseComments = require('parse-html-comments')
(input: string) => CommentDataFunction, accepts a string - the text to be searched - as its only parameter.
Returns CommentData
const parseComments = require('parse-html-comments')
parseComments(/* some string ... */) // => CommentData
Function (char: string) => voidConfigure the function to use a different delimiter for line splitting and counting.
Default is \n
const parseComments = require('parse-html-comments')
parseComments.setNewline('\r\n')
console.log(parseComments.newline) // => '\r\n'
parseComments(/* some string ... */) // => CommentData
string)Retrieve the newline character that will be used.
Object
interface CommentData {
input: string
newlineChar: string
lineCount: number
charCount: number
matches: Array<CommentDescriptor>
}
\ns in the input string ( + 1 )length property of the input stringObject
interface CommentDescriptor {
groups: {
whole: string
commentOnly: string
lines: {
whole: string[]
commentOnly: string[]
}
}
column: {
start: number
end: number
}
line: {
start: number
end: number
}
inline: null|{
pre: string|null
post: string|null
}
}
whole : The entire matched text, including preceding and following non-comment text one the start or end lines (if any).commentOnly : Only the comment textwhole : The value of groups.whole, split along the newline character into a string array.commentOnly : The value of groups.commentOnly, split along the newline character into a string array.start: Inclusive start index of whole match.end : Non-inclusive end index of whole match.start : Line number the match begins on (1-based)end : Line number the match ends on.null. If one of those conditions are true, then the value is an object with properties:
pre Either null, or a string of text corresponding to the pre-comment text.post Either null, or a string of text corresponding to the post-comment text.None
FAQs
Get html comments and their details from a string
The npm package parse-html-comments receives a total of 30 weekly downloads. As such, parse-html-comments popularity was classified as not popular.
We found that parse-html-comments 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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.