Git Product home page Git Product logo

cveinnt / letsmarkdown.com Goto Github PK

View Code? Open in Web Editor NEW
766.0 7.0 34.0 17.9 MB

๐Ÿ‘จโ€๐Ÿ’ป๐Ÿ‘ฉโ€๐Ÿ’ป Write Markdown. Together.

Home Page: https://letsmarkdown.com

License: MIT License

Shell 0.11% Dockerfile 1.20% HTML 2.63% Rust 33.27% TypeScript 56.26% CSS 5.98% JavaScript 0.55%
async distributed-systems markdown markdown-editor react rust typescript code-editor markdown-previewer reactjs

letsmarkdown.com's Introduction

๐Ÿ‘จโ€๐Ÿ’ป๐Ÿ‘ฉโ€๐Ÿ’ป LetsMarkdown.com

Fast, minimal web editor that makes markdown editing collaborative and accessible to everyone.


LetsMarkdown.com

Motivation

> I want to edit markdown files with my friends, but sending/resending files, changing viewing access, version control, and previewing are just too much work.

> ๐Ÿ’ก why not create a google doc for collaborative markdown editing, without having to log into Google, change view/edit access, worry about previewing the file, etc?

> Voilร , after hours of laborious coding, LetsMarkdown.com is born!

Features

  • Live collaborative markdown editing and preview
  • VSCode-like editor with support for command palette (syntax highlighting, autocomplete, editor themes...)
  • Minimal setup with no login required - say goodbye to malicious trackers and privacy invasions
  • Efficient backend built with Rust and WebAssembly
  • Dark mode (duh)
  • Emoji support with shortcuts enabled
  • (Upcoming) cursors tracking, synced scrolling, subscript/footnote/insert support, and more

Tech Stack

  • Frontend: React.js (TypeSript), Vite.js, Chakra UI
    • Editor & markdown preview: Monaco, mardown-it.js, highlight.js
  • Backend: Rust, WebAssembly, Node.js
  • Deployment & hosting: Docker, DigitalOcean
  • CI/CD: Github Action
  • Formatting: Prettier, Rustfmt
  • Design & prototyping: Figma

Development Info

This application is built using a backend operational transformation control server written in Rust (based on Rustpad), and a frontend written in TypeScript using React.js.

The backend server supports real-time collaborative editing sessions, and the frontend offers a collaborative text editor with built-in markdown syntax highlighting and auto-completion. These parts of the application are connected via WebSocket communication.

For markdown previewing, I used the markdown-it.js library to dynamically render the markdown file. To style the markdown file, I also created a custom markdown.css stylesheet.

To develop this application locally, you need to:

First, install Rust, wasm-pack, and Node.js. Verify your installation with:

rustup -V && wasm-pack -V && npm -v

Then, build the WebAssembly part of the app:

wasm-pack build --target web letsmarkdown-wasm

After that, install the dependencies for the React application:

npm install

Next, you can compile and run the backend web server:

cargo run

While the backend is running, open another shell and run the following command to start the frontend dev server.

npm run dev

This command will open a browser window to http://localhost:3000, with hot reloading enabled on saved changes.

Deployment

LetsMarkdown.com is distributed as a single 12 MB Docker image, which is built automatically from the Dockerfile in this repository. You can pull the latest version of this image from Docker Hub. It has multi-platform support for linux/amd64 and linux/arm64.

docker pull cveinnt/letsmarkdown

(You can also manually build this image with docker build -t rustpad . in the project root directory.) To run locally, execute the following command, then open http://localhost:3030 in your browser.

docker run --rm -dp 3030:3030 cveinnt/letsmarkdown

I deploy a public instance of this image with DigitalOcean App Platform.

Contributing

This project is still in a very early phase. If you're interested in adding new features or fixing bugs, please reach out to me by creating a GitHub issue!

I plan to integrate this repository continuously, and the code base already accounts for things like code style (Prettier, Rustfmt) and build success (Docker). The current state of the main branch is continuously deployed to the production web server at LetsMarkdown.com.

Credits

LetsMarkdown.com is inspired by composing.studio, which is based on Rustpad.


All code is licensed under the MIT license.

letsmarkdown.com's People

Contributors

cveinnt avatar needlesslygrim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

letsmarkdown.com's Issues

Font size of code, in headings, and border box.

See https://letsmarkdown.com/spurious-kick-1370

The code tags should follow the font-height for the heading element they are contained in, but they are all exactly font-height: 12px;. I think changing this to a relative value, like font-height: 0.9em; could be sufficient to solve this issue in

Moreover, if you browse <insert random MDN docs> as reference, you will see that they are using a font that has an Ascender (space above Capsize, i.e. font height) that balances out with the Descender (space below baseline, i.e. below font).1 This leads to the box around the text being more "center" than currently, where there appears to be less space above the font than below it. I'm sure you could find a suitable font for this.

Screenshot of the wrong font-height and missing Ascender, on current Firefox

screenshot

Footnotes

  1. Terminology from https://seek-oss.github.io/capsize/ โ†ฉ

Export

Add options for:

  • export as html
  • export as PDF
  • export as md

A Few Questions

I'm not sure if I am just a newbie, or if there are a few features missing (I understand it's under development and it's early)

My main question is that, I deployed on docker using the instructions, how do I change the volumes so I can change the path at the top? (Seems to default to documents>randomlygeneratedname)
Or is this by design? Do I have to install on bare metal to be able to save these files to the system? Not quite sure how it all works.

Assuming there is nothing saved in a database or on the system, and its just a editor to view and collaborate in the browser, then I think an ability to upload a markdown file to continue editing (although you can copy and paste, so this may not be needed) as well as a way to export the document (again, can copy and paste, but a button to import/export would be nice).

Overall, I really like the UI and it's simplicity. Looking forward to this projects future.

Active?

Hi there! Just checking in to see if this project is still actively being maintained.

Thank you!

README.md spelling

Under "Tech Stack", "Fontend" should be "Frontend" and "Banckend" should be "Backend"

Websockets support needs to be enabled if hosted behind a reverse proxy

Hello,

Thanks for making this, it's very useful! I was hosting the editor behind a Nginx reverse proxy using the Nginx Proxy Manager which I believe is pretty common amongst self-hosting enthusiasts and found out that the "Websockets Support" option was required to be enabled if not you would not be able to connect to the server to save your notes for collaboration. Just mentioning it here in case someone else faces the same problem.

Implement XSS prevention measures

Please consider adding XSS countermeasures for this product. It's possible to run an arbitrary JavaScript code.

To reproduce

  1. go to https://letsmarkdown.com/
  2. Get the generated URL ( https://letsmarkdown.com/pink-things-6832 )
  3. Add the following details
<img src=1 onerror="console.log(top.document.body.innerHTML='Unexpected_Page')">
  1. Ask people to access https://letsmarkdown.com/pink-things-6832

Suggested Fix

Consider disabling HTML feature on src/components/Score.tsx, or use the sanitizer package while HTML is turned on.

I assume HTML tags are not required for the most of the time.

Reference: https://github.com/markdown-it/markdown-it/blob/master/docs/security.md

Docker persistent storage

I guess when using https://<url>/<file-name> we create a new file to be edited. I do want the files to be stored persistently. How can I achieve this in docker? I can't even use docker exec -it <container-name> sh (or any other shell) to explore the directory structure. tl;dr: what folder to mount using docker, to have possible persistent storage? (maybe include it in the README.md)

Spellcheck

It would be great if there was an option to enable spellchecking and to pick the dictionary language

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.