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

carta-md

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

carta-md - npm Package Compare versions

Comparing version 2.0.7 to 2.0.8

dist/speed-highlight/asm-557af7b1.d.ts

0

dist/Global.d.ts
declare module '*.css';

7

dist/internal/carta.d.ts

@@ -17,3 +17,4 @@ import { marked } from 'marked';

}>;
type CartaEventType = 'carta-render' | 'carta-render-ssr';
declare const cartaEvents: readonly ["carta-render", "carta-render-ssr"];
type CartaEventType = (typeof cartaEvents)[number];
export type CartaListener<K extends CartaEventType | keyof HTMLElementEventMap> = [

@@ -126,4 +127,6 @@ type: K,

readonly highlightRules: ShjLanguageDefinition;
readonly listeners: CartaListeners;
readonly textareaListeners: CartaListeners;
readonly cartaListeners: CartaListeners;
readonly components: CartaExtensionComponents;
readonly dispatcher: EventTarget;
private _input;

@@ -130,0 +133,0 @@ private _renderer;

@@ -8,2 +8,3 @@ import { marked } from 'marked';

import { loadCustomLanguage, highlight, highlightAutodetect } from './highlight.js';
const cartaEvents = ['carta-render', 'carta-render-ssr'];
export class Carta {

@@ -15,4 +16,6 @@ options;

highlightRules;
listeners;
textareaListeners;
cartaListeners;
components;
dispatcher = new EventTarget();
_input;

@@ -31,5 +34,7 @@ _renderer;

this.prefixes = [];
this.listeners = [];
this.textareaListeners = [];
this.cartaListeners = [];
this.components = [];
this.highlightRules = [];
const listeners = [];
for (const ext of options?.extensions ?? []) {

@@ -39,6 +44,13 @@ this.keyboardShortcuts.push(...(ext.shortcuts ?? []));

this.prefixes.push(...(ext.prefixes ?? []));
this.listeners.push(...(ext.listeners ?? []));
this.components.push(...(ext.components ?? []));
this.highlightRules.push(...(ext.highlightRules ?? []));
listeners.push(...(ext.listeners ?? []));
}
// Split different listeners
this.textareaListeners = listeners.filter((it) => !cartaEvents.includes(it[0]));
this.cartaListeners = listeners.filter((it) => cartaEvents.includes(it[0]));
// Setup carta listeners
this.cartaListeners.forEach((it) => {
this.dispatcher.addEventListener(...it);
});
// Load default keyboard shortcuts

@@ -84,3 +96,3 @@ this.keyboardShortcuts.push(...defaultKeyboardShortcuts.filter((shortcut) => options?.disableShortcuts === true

const dirty = await marked.parse(markdown, { async: true });
this._input?.textarea.dispatchEvent(new CustomEvent('carta-render', { detail: { carta: this } }));
this.dispatcher.dispatchEvent(new CustomEvent('carta-render', { detail: { carta: this } }));
return (this.options?.sanitizer && this.options?.sanitizer(dirty)) ?? dirty;

@@ -95,3 +107,3 @@ }

const dirty = marked.parse(markdown, { async: false });
this._input?.textarea.dispatchEvent(new CustomEvent('carta-render-ssr', { detail: { carta: this } }));
this.dispatcher.dispatchEvent(new CustomEvent('carta-render-ssr', { detail: { carta: this } }));
if (this.options?.sanitizer)

@@ -110,3 +122,3 @@ return this.options.sanitizer(dirty);

prefixes: this.prefixes,
listeners: this.listeners,
listeners: this.textareaListeners,
callback: callback,

@@ -113,0 +125,0 @@ historyOpts: this.options?.historyOptions

@@ -14,3 +14,3 @@ {

},
"version": "2.0.7",
"version": "2.0.8",
"scripts": {

@@ -17,0 +17,0 @@ "dev": "vite dev",

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

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

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

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