New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

uniorg-rehype

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uniorg-rehype - npm Package Compare versions

Comparing version 0.4.5 to 0.4.6

6

lib/org-to-hast.d.ts
import { OrgData } from 'uniorg';
declare type Hast = any;
interface OrgToHastOptions {
export interface OrgToHastOptions {
imageFilenameExtensions: string[];
/**
* Whether to wrap org sections into <section>.
*/
useSections: boolean;
}
export declare function orgToHast(org: OrgData, opts?: Partial<OrgToHastOptions>): Hast;
export {};

@@ -25,2 +25,3 @@ "use strict";

],
useSections: false,
};

@@ -89,3 +90,6 @@ // `org-html-html5-elements`

}
return toHast(org.children);
const children = toHast(org.children);
return options.useSections
? h(org, 'section', { class: `section-level-${headline.level}` }, children)
: children;
}

@@ -234,2 +238,6 @@ case 'headline': {

case 'table': {
// table.el tables are not supported for export
if (org.tableType === 'table.el') {
return null;
}
// TODO: support column groups

@@ -236,0 +244,0 @@ // see https://orgmode.org/manual/Column-Groups.html

40

lib/org-to-hast.spec.js

@@ -12,8 +12,11 @@ "use strict";

const rehype_stringify_1 = __importDefault(require("rehype-stringify"));
const processor = unified_1.default()
.use(uniorg_parse_1.default)
.use(_1.default)
.use(rehype_raw_1.default)
.use(rehype_format_1.default)
.use(rehype_stringify_1.default);
const process = (input, options) => {
const processor = unified_1.default()
.use(uniorg_parse_1.default)
.use(_1.default, options)
.use(rehype_raw_1.default)
.use(rehype_format_1.default)
.use(rehype_stringify_1.default);
return processor.processSync(input).contents;
};
expect.addSnapshotSerializer({

@@ -27,21 +30,21 @@ test(value) {

});
const hastTest = (name, input) => {
const hastTest = (name, input, options) => {
it(name, () => {
const result = processor.processSync(input).contents;
const result = process(input, options);
expect(result).toMatchSnapshot();
});
};
hastTest.skip = (name, input) => {
hastTest.skip = (name, input, options) => {
it.skip(name, () => {
const result = processor.processSync(input).contents;
const result = process(input, options);
expect(result).toMatchSnapshot();
});
};
hastTest.only = (name, input) => {
hastTest.only = (name, input, options) => {
it.only(name, () => {
const result = processor.processSync(input).contents;
const result = process(input, options);
expect(result).toMatchSnapshot();
});
};
hastTest.todo = (name, _input) => {
hastTest.todo = (name, _input, _options) => {
it.todo(name);

@@ -69,2 +72,8 @@ };

`);
hastTest('useSections', `hello
* headline 1
text
** headline 1.1
more text
* headline 2`, { useSections: true });
hastTest('planning', `* headline

@@ -178,2 +187,7 @@ CLOSED: [2019-03-13 Wed 23:48] SCHEDULED: [2019-03-13 Wed] DEADLINE: [2019-03-14 Thu]`);

`);
hastTest('table.el table', `
+------+
| blah |
+------+
`);
hastTest('comments', `hello

@@ -180,0 +194,0 @@ # comment

@@ -1,1 +0,3 @@

export default function org2rehype(): (org: any) => any;
import { OrgToHastOptions } from './org-to-hast';
export type { OrgToHastOptions } from './org-to-hast';
export default function org2rehype(options?: Partial<OrgToHastOptions>): (org: any) => any;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const org_to_hast_1 = require("./org-to-hast");
function org2rehype() {
function org2rehype(options) {
return transformer;
function transformer(org) {
return org_to_hast_1.orgToHast(org);
return org_to_hast_1.orgToHast(org, options);
}

@@ -9,0 +9,0 @@ }

{
"name": "uniorg-rehype",
"version": "0.4.5",
"version": "0.4.6",
"description": "uniorg plugin to transform to rehype",

@@ -55,3 +55,3 @@ "keywords": [

},
"gitHead": "3d6bc077f2ee16eebf35d57e6b93d98022e0b65d"
"gitHead": "528e9b6682a95a46054e015aeb30d65b759f9bd5"
}

Sorry, the diff of this file is not supported yet

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