Compare commits

...

4 commits

Author SHA1 Message Date
4efe62525a
update README 2024-05-11 02:25:29 +02:00
1bec37f3bd
fix: rename package name 2024-05-11 02:20:51 +02:00
13240b3486
update repo URL 2024-05-11 02:11:27 +02:00
126d18983a
set publish branch to slim 2024-05-11 02:08:52 +02:00
48 changed files with 63 additions and 107 deletions

1
.npmrc
View file

@ -1,2 +1,3 @@
engine-strict=true
auto-install-peers=true
publish-branch=slim

View file

@ -21,7 +21,9 @@
<div align="center">
<a href="https://beartocode.github.io/carta/">📚 Documentation</a>
<span> · </span>
<a href="https://github.com/BearToCode/carta">GitHub</a>
<a href="https://code.thetadev.de/ThetaDev/carta">Source code</a>
<span> · </span>
<a href="https://github.com/BearToCode/carta">Original GitHub</a>
</div>
<br>
@ -36,6 +38,12 @@
Carta is a **lightweight**, **fast** and **extensible** Svelte Markdown editor and viewer. It is powered by [unified](https://github.com/unifiedjs/unified), [remark](https://github.com/remarkjs/remark) and [rehype](https://github.com/rehypejs/rehype). Check out the [examples](http://beartocode.github.io/carta/examples) to see it in action.
Differently from most editors, Carta does not include a code editor, but it is _just_ a textarea with syntax highlighting, shortcuts and more.
This is a fork of carta which applies the following changes:
- Replace Shiki syntax higlighter with Prism.js (much more lightweight, 90kB vs 385kB bundle size for minimal test application)
- Make markdown renderer class configurable and set it to `prose` by default (for Tailwind support)
- Make markdown input usable without JS
## Features
- 🌈 Markdown syntax highlighting ([Shiki](https://shiki.style/));
@ -100,7 +108,7 @@ npm i @cartamd/plugin-name
```svelte
<script lang="ts">
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
// Component default theme
import 'carta-md/default.css';

View file

@ -1,5 +1,5 @@
<script lang="ts">
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { emoji } from '@cartamd/plugin-emoji';
import { code } from '@cartamd/plugin-code';
import PlusCircled from './assets/PlusIcon.svelte';

View file

@ -1,5 +1,5 @@
<script lang="ts">
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { attachment } from '@cartamd/plugin-attachment';
import { emoji } from '@cartamd/plugin-emoji';
import { slash } from '@cartamd/plugin-slash';

View file

@ -1,5 +1,5 @@
<script lang="ts">
import { Carta, MarkdownEditor, Markdown } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor, Markdown } from '@thetadev/carta-md';
import placeholder from './math-stack-exchange-placeholder.tex?raw';
import { math } from '@cartamd/plugin-math';
import { tikz } from '@cartamd/plugin-tikz';

View file

@ -37,7 +37,7 @@ Setup a basic editor:
```svelte
<script>
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import 'carta-md/default.css'; /* Default theme */
const carta = new Carta({
@ -68,7 +68,7 @@ Or, if you just want to render content:
```svelte
<script>
import { Carta, Markdown } from '@thetadev256/carta-md';
import { Carta, Markdown } from '@thetadev/carta-md';
const carta = new Carta({
/* ... */

View file

@ -39,7 +39,7 @@ import '@cartamd/plugin-anchor/default.css';
```svelte
<script>
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { anchor } from '@cartamd/plugin-anchor';
const carta = new Carta({

View file

@ -35,7 +35,7 @@ import '@cartamd/plugin-attachment/default.css';
```svelte
<script>
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { attachment } from '@cartamd/plugin-attachment';
const carta = new Carta({

View file

@ -62,7 +62,7 @@ It is no longer possible to specify a custom highlighter in this plugin. However
```svelte
<script>
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { code } from '@cartamd/plugin-code';
const carta = new Carta({

View file

@ -39,7 +39,7 @@ import '@cartamd/plugin-emoji/default.css';
```svelte
<script>
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { emoji } from '@cartamd/plugin-emoji';
const carta = new Carta({

View file

@ -5,7 +5,7 @@ title: Math
<script>
import Code from '$lib/components/code/Code.svelte';
import { Markdown, Carta } from '@thetadev256/carta-md';
import { Markdown, Carta } from '@thetadev/carta-md';
import { math } from '@cartamd/plugin-math';
import 'katex/dist/katex.css';
@ -78,7 +78,7 @@ or by using a content delivery network:
```svelte
<script>
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { math } from '@cartamd/plugin-math';
const carta = new Carta({

View file

@ -39,7 +39,7 @@ import '@cartamd/plugin-slash/default.css';
```svelte
<script>
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { slash } from '@cartamd/plugin-slash';
const carta = new Carta({

View file

@ -29,7 +29,7 @@ npm i @cartamd/plugin-tikz
```svelte
<script>
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { tikz } from '@cartamd/plugin-tikz';
import '@cartamd/plugin-tikz/fonts.css';

View file

@ -113,7 +113,7 @@ Unified plugins need to be wrapped inside a `UnifiedTransformer` type, to be abl
<Code>
```ts
import type { UnifiedTransformer } from '@thetadev256/carta-md';
import type { UnifiedTransformer } from '@thetadev/carta-md';
const hashtagTransformer: UnifiedTransformer<'sync'> = {
execution: 'sync', // Sync, since the plugin is synchronous
@ -158,7 +158,7 @@ To do that, we create a listener that:
<Code>
```ts
import type { Listener } from '@thetadev256/carta-md';
import type { Listener } from '@thetadev/carta-md';
import Hashtag from './Hashtag.svelte';
const convertHashtags: Listener<'carta-render'> = [
@ -193,7 +193,7 @@ Let's now create a Plugin with the transformer and the listener:
<Code>
```ts
import type { Plugin } from '@thetadev256/carta-md';
import type { Plugin } from '@thetadev/carta-md';
export const hashtag = (): Plugin => ({
transformers: [hashtagTransformer],
@ -206,7 +206,7 @@ export const hashtag = (): Plugin => ({
We can now use the plugin with the following:
```ts
import { Carta } from '@thetadev256/carta-md';
import { Carta } from '@thetadev/carta-md';
const carta = new Carta({
// ...

View file

@ -100,7 +100,7 @@ npm i @cartamd/plugin-name
```svelte
<script lang="ts">
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
// Component default theme
import 'carta-md/default.css';

View file

@ -6,7 +6,7 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/BearToCode/carta.git"
"url": "git+https://code.thetadev.de/ThetaDev/carta.git"
},
"exports": {
".": {
@ -14,7 +14,8 @@
"svelte": "./dist/index.js",
"import": "./dist/index.js"
},
"./default.css": "./dist/default.css"
"./default.css": "./dist/default.css",
"./highlight.css": "./dist/highlight.css"
},
"version": "1.0.0",
"scripts": {

View file

@ -20,7 +20,7 @@ import '@cartamd/plugin-anchor/default.css';
```svelte
<script>
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { anchor } from '@cartamd/plugin-anchor';
const carta = new Carta({

View file

@ -36,7 +36,7 @@
"rehype-slug": "^6.0.0"
},
"peerDependencies": {
"@thetadev256/carta-md": "^4.0.0",
"@thetadev/carta-md": "^4.0.0",
"svelte": "^3.54.0 || ^4.0.0"
},
"devDependencies": {

View file

@ -1,6 +1,6 @@
import rehypeSlug, { type Options as SlugOptions } from 'rehype-slug';
import rehypeAutolinkHeadings, { type Options as AutolinkOptions } from 'rehype-autolink-headings';
import type { Plugin } from '@thetadev256/carta-md';
import type { Plugin } from '@thetadev/carta-md';
export * from './default.css?inline';
export interface AnchorExtensionOptions {

View file

@ -1,5 +1,5 @@
<script lang="ts">
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { anchor } from '$lib';
import 'carta-md/default.css';
import '$lib/default.css';

View file

@ -20,7 +20,7 @@ import '@cartamd/plugin-attachment/default.css';
```svelte
<script lang="ts">
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { attachment } from '@cartamd/plugin-attachment';
const carta = new Carta({

View file

@ -34,7 +34,7 @@
"!dist/**/*.spec.*"
],
"peerDependencies": {
"@thetadev256/carta-md": "^4.0.0",
"@thetadev/carta-md": "^4.0.0",
"marked": "^9.1.5",
"svelte": "^3.54.0 || ^4.0.0"
},

View file

@ -1,5 +1,5 @@
<script lang="ts">
import type { Carta } from '@thetadev256/carta-md';
import type { Carta } from '@thetadev/carta-md';
import type { Writable } from 'svelte/store';
import UploadIcon from './icons/UploadIcon.svelte';
import type { SvelteComponent } from 'svelte';

View file

@ -1,5 +1,5 @@
<script lang="ts">
import type { Carta } from '@thetadev256/carta-md';
import type { Carta } from '@thetadev/carta-md';
import SpinnerIcon from './icons/SpinnerIcon.svelte';
import type { Writable } from 'svelte/store';
import type { SvelteComponent } from 'svelte';

View file

@ -1,4 +1,4 @@
import type { Carta, Plugin, Listener } from '@thetadev256/carta-md';
import type { Carta, Plugin, Listener } from '@thetadev/carta-md';
import { get, writable, type Writable } from 'svelte/store';
import type { SvelteComponent } from 'svelte';
import DropOverlay from './DropOverlay.svelte';

View file

@ -1,6 +1,6 @@
<script lang="ts">
import { attachment } from '$lib';
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import 'carta-md/default.css';
import '$lib/default.css';

View file

@ -42,7 +42,7 @@ It is no longer possible to specify a custom highlighter in this plugin. However
```svelte
<script lang="ts">
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { code } from '@cartamd/plugin-code';
const carta = new Carta({

View file

@ -23,7 +23,7 @@
"typescript-cp": "^0.1.8"
},
"peerDependencies": {
"@thetadev256/carta-md": "^4.0.0"
"@thetadev/carta-md": "^4.0.0"
},
"files": [
"dist"

View file

@ -1,4 +1,4 @@
import type { DualTheme, Theme, Plugin } from '@thetadev256/carta-md';
import type { DualTheme, Theme, Plugin } from '@thetadev/carta-md';
import type { RehypeShikiOptions } from '@shikijs/rehype';
import rehypeShikiFromHighlighter from '@shikijs/rehype/core';

View file

@ -20,7 +20,7 @@ import '@cartamd/plugin-emoji/default.css';
```svelte
<script lang="ts">
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { emoji } from '@cartamd/plugin-emoji';
const carta = new Carta({

View file

@ -37,7 +37,7 @@
"remark-gemoji": "^8.0.0"
},
"peerDependencies": {
"@thetadev256/carta-md": "^4.0.0",
"@thetadev/carta-md": "^4.0.0",
"svelte": "^3.54.0 || ^4.0.0"
},
"devDependencies": {

View file

@ -1,5 +1,5 @@
<script lang="ts">
import type { Carta } from '@thetadev256/carta-md';
import type { Carta } from '@thetadev/carta-md';
import { onDestroy, onMount } from 'svelte';
import nodeEmoji from 'node-emoji';
import type { TransitionConfig } from 'svelte/transition';

View file

@ -3,7 +3,7 @@ import type {
ExtensionComponent,
GrammarRule,
HighlightingRule
} from '@thetadev256/carta-md';
} from '@thetadev/carta-md';
import remarkGemoji from 'remark-gemoji';
import { fade, scale, type TransitionConfig } from 'svelte/transition';
import Emoji from './Emoji.svelte';

View file

@ -1,5 +1,5 @@
<script lang="ts">
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { emoji } from '$lib';
import 'carta-md/default.css';
import '$lib/default.css';

View file

@ -38,7 +38,7 @@ or by using a content delivery network:
```svelte
<script lang="ts">
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { math } from '@cartamd/plugin-math';
const carta = new Carta({

View file

@ -21,7 +21,7 @@
"typescript": "^5.0.4"
},
"peerDependencies": {
"@thetadev256/carta-md": "^4.0.0"
"@thetadev/carta-md": "^4.0.0"
},
"files": [
"dist"

View file

@ -1,4 +1,4 @@
import type { Plugin } from '@thetadev256/carta-md';
import type { Plugin } from '@thetadev/carta-md';
import remarkMath, { type Options as RemarkMathOptions } from 'remark-math';
import rehypeKatex, { type Options as RehypeKatexOptions } from 'rehype-katex';

View file

@ -20,7 +20,7 @@ import '@cartamd/plugin-slash/default.css';
```svelte
<script lang="ts">
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { slash } from '@cartamd/plugin-slash';
const carta = new Carta({

View file

@ -35,7 +35,7 @@
"bezier-easing": "^2.1.0"
},
"peerDependencies": {
"@thetadev256/carta-md": "^4.0.0",
"@thetadev/carta-md": "^4.0.0",
"svelte": "^3.54.0 || ^4.0.0"
},
"devDependencies": {

View file

@ -1,5 +1,5 @@
<script lang="ts">
import type { Carta } from '@thetadev256/carta-md';
import type { Carta } from '@thetadev/carta-md';
import type { SlashSnippet } from './snippets';
import type { TransitionConfig } from 'svelte/transition';
import { onDestroy, onMount } from 'svelte';

View file

@ -1,6 +1,6 @@
import { fade, scale, type TransitionConfig } from 'svelte/transition';
import SlashComponent from './Slash.svelte';
import type { Plugin, ExtensionComponent } from '@thetadev256/carta-md';
import type { Plugin, ExtensionComponent } from '@thetadev/carta-md';
import BezierEasing from 'bezier-easing';
import { defaultSnippets, type DefaultSnippetId, type SlashSnippet } from './snippets';
export * from './default.css?inline';

View file

@ -1,4 +1,4 @@
import type { InputEnhancer } from '@thetadev256/carta-md';
import type { InputEnhancer } from '@thetadev/carta-md';
export interface SlashSnippet {
/**

View file

@ -1,5 +1,5 @@
<script lang="ts">
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { slash } from '$lib';
import 'carta-md/default.css';
import '$lib/default.css';

View file

@ -16,7 +16,7 @@ npm i @cartamd/plugin-tikz
```svelte
<script lang="ts">
import { Carta, MarkdownEditor } from '@thetadev256/carta-md';
import { Carta, MarkdownEditor } from '@thetadev/carta-md';
import { tikz } from '@cartamd/plugin-tikz';
import '@cartamd/plugin-tikz/fonts.css';

View file

@ -29,7 +29,7 @@
"vite-raw-plugin": "^1.0.2"
},
"peerDependencies": {
"@thetadev256/carta-md": "^4.0.0"
"@thetadev/carta-md": "^4.0.0"
},
"files": [
"dist"

View file

@ -1,4 +1,4 @@
import type { Carta, Event, Plugin } from '@thetadev256/carta-md';
import type { Carta, Event, Plugin } from '@thetadev/carta-md';
import type { Plugin as UnifiedPlugin } from 'unified';
import { visit, SKIP } from 'unist-util-visit';
import { fromDom } from 'hast-util-from-dom';

View file

@ -211,9 +211,6 @@ importers:
packages/plugin-anchor:
dependencies:
carta-md:
specifier: ^4.0.0
version: 4.0.2(svelte@4.2.2)
rehype-autolink-headings:
specifier: ^7.1.0
version: 7.1.0
@ -259,10 +256,6 @@ importers:
version: 5.1.6(@types/node@18.16.3)(sass@1.69.5)
packages/plugin-attachment:
dependencies:
carta-md:
specifier: ^4.0.0
version: 4.0.2(svelte@4.2.12)
devDependencies:
'@sveltejs/adapter-auto':
specifier: ^3.1.1
@ -309,9 +302,6 @@ importers:
'@shikijs/rehype':
specifier: ^1.4.0
version: 1.4.0
carta-md:
specifier: ^4.0.0
version: 4.0.2(svelte@4.2.12)
unified:
specifier: ^11.0.4
version: 11.0.4
@ -334,9 +324,6 @@ importers:
bezier-easing:
specifier: ^2.1.0
version: 2.1.0
carta-md:
specifier: ^4.0.0
version: 4.0.2(svelte@4.2.12)
node-emoji:
specifier: ^1.11.0
version: 1.11.0
@ -386,9 +373,6 @@ importers:
packages/plugin-math:
dependencies:
carta-md:
specifier: ^4.0.0
version: 4.0.2(svelte@4.2.12)
rehype-katex:
specifier: ^7.0.0
version: 7.0.0
@ -408,9 +392,6 @@ importers:
bezier-easing:
specifier: ^2.1.0
version: 2.1.0
carta-md:
specifier: ^4.0.0
version: 4.0.2(svelte@4.2.12)
devDependencies:
'@sveltejs/adapter-auto':
specifier: ^3.1.1
@ -454,9 +435,6 @@ importers:
packages/plugin-tikz:
dependencies:
carta-md:
specifier: ^4.0.0
version: 4.0.2(svelte@4.2.12)
hast-util-from-dom:
specifier: ^5.0.0
version: 5.0.0
@ -2332,38 +2310,6 @@ packages:
redeyed: 2.1.1
dev: true
/carta-md@4.0.2(svelte@4.2.12):
resolution: {integrity: sha512-wMlw0r5RZiVwvF3dyxE/vHj9pXlXbzpijJ3m/o9zqZe7Cf6D96AjyBHBpa0A0OPj/uEJVF3k0R6ctopBJCpCQg==}
peerDependencies:
svelte: ^3.54.0 || ^4.0.0
dependencies:
rehype-stringify: 10.0.0
remark-gfm: 4.0.0
remark-parse: 11.0.0
remark-rehype: 11.1.0
shiki: 1.4.0
svelte: 4.2.12
unified: 11.0.4
transitivePeerDependencies:
- supports-color
dev: false
/carta-md@4.0.2(svelte@4.2.2):
resolution: {integrity: sha512-wMlw0r5RZiVwvF3dyxE/vHj9pXlXbzpijJ3m/o9zqZe7Cf6D96AjyBHBpa0A0OPj/uEJVF3k0R6ctopBJCpCQg==}
peerDependencies:
svelte: ^3.54.0 || ^4.0.0
dependencies:
rehype-stringify: 10.0.0
remark-gfm: 4.0.0
remark-parse: 11.0.0
remark-rehype: 11.1.0
shiki: 1.4.0
svelte: 4.2.2
unified: 11.0.4
transitivePeerDependencies:
- supports-color
dev: false
/ccount@2.0.1:
resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
dev: false

View file

@ -34,7 +34,7 @@ export const execAsync = (command, cwd = undefined, options = { showLog: false }
* List of all the packages.
*/
export const packages = [
'@thetadev256/carta-md',
'@thetadev/carta-md',
'plugin-math',
'plugin-slash',
'plugin-emoji',