davidmyersdev / ink-mde

A beautiful, modern, customizable Markdown editor powered by CodeMirror 6 and TypeScript
https://stackblitz.com/fork/github/davidmyersdev/ink-mde/tree/main/examples/template-ts?file=src/main.ts
MIT License
233 stars 16 forks source link

Please allow for vanilla javascript #88

Open tiagorangel1 opened 5 months ago

tiagorangel1 commented 5 months ago

I would love to use this, but the app I'm working on uses vanilla javascript. No frameworks, no fancy stuff.

flatsiedatsie commented 5 months ago

Related: https://github.com/davidmyersdev/ink-mde/issues/87

davidmyersdev commented 4 months ago

@tiagorangel2011 I'm not sure what you mean. The core library is already built to work with vanilla JS.

flatsiedatsie commented 4 months ago

That's wonderul news.

Could you perhaps create a tiny example for that use case? How would I use the library to generate a minimal text area and UI?

tiagorangel1 commented 4 months ago

Using the HTML provided in the README results in a error (see #87)

  <div id="editor"></div>
  <script type="module">
      import { ink } from 'https://esm.sh/ink-mde@0.22.0';
      ink(document.getElementById('editor')!);
  </script>
330915941-8d0a12de-ea98-42cc-888f-54d5a7333574
flatsiedatsie commented 4 months ago

Using the HTML provided in the README results in a error (see #87)

  <div id="editor"></div>
  <script type="module">
    import { ink } from 'https://esm.sh/ink-mde@0.22.0';
    ink(document.getElementById('editor')!);
  </script>
330915941-8d0a12de-ea98-42cc-888f-54d5a7333574

Yes, that was the exact same issue I was having: https://github.com/davidmyersdev/ink-mde/issues/87

davidmyersdev commented 3 months ago

@tiagorangel2011 @flatsiedatsie it sounds like there might be an issue with the esm.sh service then. If you install it via NPM, I think it would work. I'll open this back up to investigate that service though.

flatsiedatsie commented 3 months ago

Wonderful, thank you!

Would it perhaps be possible to provide a single-file version of the library? For privacy protection reasons I can't use a CDN, the library files must be provided from the same server as the rest of the project. I've tried downloading the files form ESM, but that's quite hard to do, because it links to many other files, and those link to yet more files, etc.

davidmyersdev commented 2 months ago

@flatsiedatsie a single file version might be possible, but it would be pretty large due to the various dynamic imports that are used for code block language parsers, optional features, etc. It'd be better to install it via NPM and bundle it with something like Vite if that's possible.

tiagorangel1 commented 2 months ago

how am I supposed to link it after installing with npm? this:

<div id="editor"></div>
<script type="module">
  import { ink } from '/node_modules/ink-mde/dist/index.js'

  ink(document.getElementById('editor'))</script>

plus basic HTTP server returns in error Uncaught TypeError: The specifier “solid-js/web” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.

sorry I'm kinda of a noob when it comes to this kind of stuff. I really don't want to use anything like vite

flatsiedatsie commented 2 months ago

@davidmyersdev Thanks

It'd be better to install it via NPM and bundle it with something like Vite if that's possible.

Unfortunately that's not possible. I'm trying to integrate it into an existing plain JS project. And like the poster above, I know nothing about Vite either.

it would be pretty large due to the various dynamic imports

That's no issue. The project loads multiple gigabytes of AI files (.gguf) to the browser, so large is very relative in my case :-)

Screenshot 2024-09-12 at 12 45 04