
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
gavel2html
Advanced tools
A utility library to render an HTML diff from the Gavel.js validation results.
npm install gavel2html
const gavel = require('gavel');
const Gavel2Html = require('gavel2html');
// Validate expected/actual HTTP transaction with Gavel.
const gavelResult = gavel(expected, actual);
const renderer = new Gavel2Html({
// Pass the name of the field you wish to render
fieldName: 'body',
// ...and the validation result for that field
fieldResult: gavelResult.fields.body,
});
const html = renderer.getHtml({
wrapWith: '##data',
startTag: '<span>',
endTag: '</span>',
missingStartTag: '<span class="missing">',
addedStartTag: '<span class="added">',
changedStartTag: '<span class="changed">',
comments: true,
commentStartTag: '<span class="comments">',
commentEndTag: '</span>',
identString: ' '
});
console.log(html);
<span>{"name": "hell</span><span class="missing">o</span><span>"}</span>
Gavel2Html(options)
Creates a renderer instance with the given options.
{
// Gavel validation results field name.
// Affects the converter being used internally.
fieldName: 'statusCode' | 'headers' | 'body'
// Gavel validation results for the given `fieldName`.
// Refer to the Gavel's documentation for more details.
fieldResults: GavelFieldValidationResults
// Use JSON pointers from the Gavel validation results
// passed in the `fieldResults` option.
usePointers?: boolean
}
getHtml(options): string
Returns an HTML string representing the markup of the validation results data diff.
{
// String to wrap the outpout data with.
// The "##data" acts as a placeholder that gets
// substituted with the output results.
// Example: <div>##data</div>.
wrapWith?: string = '##data'
startTag?: string = '<li>'
endTag?: string = '</li>'
jsonKeyStartTag?: string = ''
jsonKeyEndTag?: string = ''
// String to use at the beginning of
// a missing sequence of characters.
missingStartTag?: string
// String to use at the beginning of
// an added sequence of characters.
addedStartTag?: string
// String to use as a start when marking
// a changed sequence of characters.
changedStartTag?: string
// Include comments in the output.
comments?: boolean
commentStartTag?: string
commentEndTag?: string
// String to use as a one level of indentation.
identString?: string = ' '
}
FAQs
Convert output from Gavel to HTML
The npm package gavel2html receives a total of 5 weekly downloads. As such, gavel2html popularity was classified as not popular.
We found that gavel2html demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.