You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
describe("replacer option",function(){it("can modify specify node",function(){constoriginalText="This is `code`.";constAST=parse(originalText);constsource=newStringSource(AST,{replacer({ node, maskValue }){if(node.type==="Code"){returnmaskValue("_");}return;}});assert.strictEqual(source.toString(),"This is ____.");});it("modify and get original index",function(){constAST=parse("This is `TEST`.");constsource=newStringSource(AST,{replacer({ node, deleteNode }){if(node.type==="Code"){returndeleteNode();}return;}});assert.strictEqual(source.toString(),"This is .");});})
Sometimes, we want to mask
Code
node inParagraph
node.In almost case, textlint rules do not want to handle
Code
node.Example
Inspired by JSON.stringify() - JavaScript | MDN
The text was updated successfully, but these errors were encountered: