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

@launchpad-ui/markdown

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@launchpad-ui/markdown - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

dist/style.css

20

dist/index.es.js

@@ -1,9 +0,7 @@

// src/Markdown.tsx
import './style.css';
import { cx } from "classix";
import DOMPurify2 from "isomorphic-dompurify";
import "./styles/Markdown.css";
// src/utils.ts
import DOMPurify from "isomorphic-dompurify";
import { marked } from "marked";
import { jsx } from "react/jsx-runtime";
const Markdown$1 = "";
function isAnchorNode(node) {

@@ -42,6 +40,3 @@ return node.tagName.toLowerCase() === "a";

}
// src/Markdown.tsx
import { jsx } from "react/jsx-runtime";
DOMPurify2.addHook("afterSanitizeAttributes", (node) => {
DOMPurify.addHook("afterSanitizeAttributes", (node) => {
if (isAnchorNode(node) && node.target.toLowerCase() === "_blank") {

@@ -53,3 +48,3 @@ node.setAttribute("rel", "noopener noreferrer");

});
var Markdown = ({
const Markdown = ({
source,

@@ -68,3 +63,6 @@ className,

dangerouslySetInnerHTML: {
__html: renderMarkdown(source, { baseUri, allowedTags })
__html: renderMarkdown(source, {
baseUri,
allowedTags
})
},

@@ -71,0 +69,0 @@ ref: textRef,

@@ -0,41 +1,11 @@

require('./style.css');
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
Markdown: () => Markdown
});
module.exports = __toCommonJS(src_exports);
// src/Markdown.tsx
var import_classix = require("classix");
var import_isomorphic_dompurify2 = __toESM(require("isomorphic-dompurify"));
var import_Markdown = require("./styles/Markdown.css");
// src/utils.ts
var import_isomorphic_dompurify = __toESM(require("isomorphic-dompurify"));
var import_marked = require("marked");
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const classix = require("classix");
const DOMPurify = require("isomorphic-dompurify");
const marked = require("marked");
const jsxRuntime = require("react/jsx-runtime");
const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
const DOMPurify__default = /* @__PURE__ */ _interopDefaultLegacy(DOMPurify);
const Markdown$1 = "";
function isAnchorNode(node) {

@@ -48,4 +18,4 @@ return node.tagName.toLowerCase() === "a";

} = {}) {
const renderer = new import_marked.marked.Renderer();
import_marked.marked.setOptions({
const renderer = new marked.marked.Renderer();
marked.marked.setOptions({
gfm: true,

@@ -55,3 +25,3 @@ breaks: true

renderer.link = function(href, title, text) {
const link = import_marked.marked.Renderer.prototype.link.call(this, href, title, text);
const link = marked.marked.Renderer.prototype.link.call(this, href, title, text);
if (!(href.startsWith("https://") || href.startsWith("http://"))) {

@@ -65,3 +35,3 @@ return link;

};
const html = (0, import_marked.marked)(source, { renderer });
const html = marked.marked(source, { renderer });
const sanitizationConfig = {

@@ -75,8 +45,5 @@ KEEP_CONTENT: false,

}
return import_isomorphic_dompurify.default.sanitize(html, sanitizationConfig);
return DOMPurify__default.default.sanitize(html, sanitizationConfig);
}
// src/Markdown.tsx
var import_jsx_runtime = require("react/jsx-runtime");
import_isomorphic_dompurify2.default.addHook("afterSanitizeAttributes", (node) => {
DOMPurify__default.default.addHook("afterSanitizeAttributes", (node) => {
if (isAnchorNode(node) && node.target.toLowerCase() === "_blank") {

@@ -88,3 +55,3 @@ node.setAttribute("rel", "noopener noreferrer");

});
var Markdown = ({
const Markdown = ({
source,

@@ -99,7 +66,10 @@ className,

const Container = container;
const classes = (0, import_classix.cx)("Markdown", className);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, {
const classes = classix.cx("Markdown", className);
return /* @__PURE__ */ jsxRuntime.jsx(Container, {
className: classes,
dangerouslySetInnerHTML: {
__html: renderMarkdown(source, { baseUri, allowedTags })
__html: renderMarkdown(source, {
baseUri,
allowedTags
})
},

@@ -110,6 +80,3 @@ ref: textRef,

};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Markdown
});
exports.Markdown = Markdown;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import type { RefObject } from 'react';
import type { ElementType, RefObject } from 'react';
import './styles/Markdown.css';

@@ -8,3 +8,3 @@ declare type MarkdownProps = {

allowedTags?: string[];
container?: React.ElementType;
container?: ElementType;
textRef?: RefObject<HTMLElement>;

@@ -11,0 +11,0 @@ testId?: string;

{
"name": "@launchpad-ui/markdown",
"version": "0.2.2",
"version": "0.3.0",
"status": "beta",

@@ -25,3 +25,3 @@ "publishConfig": {

"./package.json": "./package.json",
"./styles/*": "./dist/styles/*"
"./style.css": "./dist/style.css"
},

@@ -32,3 +32,3 @@ "source": "src/index.ts",

"classix": "^2.1.13",
"isomorphic-dompurify": "^0.20.0",
"isomorphic-dompurify": "^0.22.0",
"marked": "^4.0.12"

@@ -46,3 +46,3 @@ },

"scripts": {
"build": "tsc --project tsconfig.build.json && node ../../scripts/build.js",
"build": "vite build -c ../../vite.config.ts && tsc --project tsconfig.build.json",
"clean": "rm -rf dist",

@@ -49,0 +49,0 @@ "e2e": "playwright test --config=../../playwright.config.ct.ts",

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