Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uniorg-slug

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uniorg-slug - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

6

lib/index.js

@@ -18,4 +18,6 @@ "use strict";

const props = (data.hProperties = data.hProperties || {});
const id = (_a = customId(node)) !== null && _a !== void 0 ? _a : slugger.slug(orgast_util_to_string_1.toString(node.title));
props.id = id;
if (!props.id) {
const id = (_a = customId(node)) !== null && _a !== void 0 ? _a : slugger.slug(orgast_util_to_string_1.toString(node.title));
props.id = id;
}
});

@@ -22,0 +24,0 @@ }

@@ -18,3 +18,3 @@ "use strict";

};
describe('uniorg-extract-keywords', () => {
describe('uniorg-slug', () => {
test('does not crash on empty document', () => {

@@ -65,3 +65,17 @@ const document = ``;

});
test('preserves data.hProperties.id', () => {
const processor = unified_1.default()
.use(uniorg_parse_1.default)
.use(() => (node) => {
const headline = unist_util_find_1.default(node, { type: 'headline' });
headline.data = { hProperties: { id: 'my-custom-id' } };
})
.use(_1.uniorgSlug)
.use(uniorg_rehype_1.default)
.use(rehype_stringify_1.default);
const document = `* some headline`;
const s = processor.processSync(document).contents;
expect(s).toMatchInlineSnapshot(`"<h1 id=\\"my-custom-id\\">some headline</h1>"`);
});
});
//# sourceMappingURL=index.spec.js.map
{
"name": "uniorg-slug",
"version": "0.2.1",
"version": "0.2.2",
"description": "uniorg plugin to add `id` attributes to headlines",

@@ -54,7 +54,7 @@ "keywords": [

"uniorg-parse": "^0.2.1",
"uniorg-rehype": "^0.2.1",
"uniorg-rehype": "^0.2.2",
"unist-util-find": "^1.0.2",
"vfile": "^4.2.1"
},
"gitHead": "6497e86a0baea4535ba58ab58579575d54b3c1f2"
"gitHead": "38e111005635ffb1b92392dac4c3d8913aaddb64"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc