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.5.0 to 2.6.0

0

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

9

dist/internal/carta.js

@@ -7,3 +7,3 @@ import { Marked } from 'marked';

import { CartaRenderer } from './renderer';
import { loadCustomLanguage, highlight, highlightAutodetect } from './highlight.js';
import { loadCustomLanguage, highlight, highlightAutodetect, loadCustomMarkdown } from './highlight.js';
import { mangle } from 'marked-mangle';

@@ -96,8 +96,3 @@ import { gfmHeadingId } from 'marked-gfm-heading-id';

// Load highlight custom language
import('./shj.js')
.then((module) => {
// inject custom rules
module.default.unshift(...this.highlightRules);
return loadCustomLanguage('cartamd', module);
})
loadCustomMarkdown(this.options?.extensions ?? [])
// trigger re-render

@@ -104,0 +99,0 @@ .then(() => this.input?.update());

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

import { type ShjLanguageDefinition } from '@speed-highlight/core';
import { type ShjLanguage, type ShjLanguageDefinition } from '@speed-highlight/core';
import type { CartaExtension } from './carta';
interface Nothing {
}
type Union<T, U> = T | (U & Nothing);
type Lang = Union<ShjLanguage, string>;
/**

@@ -10,3 +15,3 @@ * Highlight text using Speed-Highlight. May return null on error(usually if requested

*/
export declare function highlight(text: string, lang: string, hideLineNumbers?: boolean): Promise<string | null>;
export declare function highlight(text: string, lang: Lang, hideLineNumbers?: boolean): Promise<string | null>;
/**

@@ -49,1 +54,8 @@ * Highlight text using Speed-Highlight with detected language.

}
/**
* Load custom markdown syntax highlighting rules.
* Automatically called when a Carta instance is created.
* @param extensions Additional extensions used in Carta.
*/
export declare function loadCustomMarkdown(extensions?: CartaExtension[]): Promise<void>;
export {};
import { detectLanguage } from '@speed-highlight/core/detect.js';
import { highlightText, loadLanguage } from '@speed-highlight/core';
import cartaMarkdown from './shj';
/**

@@ -54,1 +55,11 @@ * Highlight text using Speed-Highlight. May return null on error(usually if requested

}
/**
* Load custom markdown syntax highlighting rules.
* Automatically called when a Carta instance is created.
* @param extensions Additional extensions used in Carta.
*/
export async function loadCustomMarkdown(extensions = []) {
const highlightRules = extensions.map((ext) => ext.highlightRules ?? []).flat();
const lang = Array.prototype.concat(cartaMarkdown, highlightRules);
loadCustomLanguage('cartamd', { default: lang });
}

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

},
"version": "2.5.0",
"version": "2.6.0",
"scripts": {

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

@@ -34,3 +34,5 @@ <div align="center">

> :exclamation:Warning: **sanitization** is **not** dealt with by Carta. You need to provide a `sanitizer` in the options.
> **Warning**
> Sanitization is not dealt with by Carta. You need to provide a `sanitizer` in the options.
> Common sanitizers are [isomorphic-dompurify](https://www.npmjs.com/package/isomorphic-dompurify) (suggested) and [sanitize-html](https://www.npmjs.com/package/sanitize-html).

@@ -37,0 +39,0 @@ ### Installation

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