Coder Social home page Coder Social logo

muya's Introduction

MarkText

MarkText

🔆 Next generation markdown editor 🌙
A simple and elegant open-source markdown editor that focused on speed and usability.
Available for Linux, macOS and Windows.

This Markdown editor that could. Built with ❤︎ by Jocs and contributors .

Supporting MarkText

MarkText is an MIT licensed open source project, and the latest version will always be downloadable for free from the GitHub release page. MarkText is still in development, and its development is inseparable from all sponsors. I hope you join them:

What's the difference between Patreon and Open Collective?

Patreon: Funds will be directly sponsored to Luo Ran (@jocs) who created MarkText and continues to maintain it. Open Collective: All expenses are transparent. The funds will be used for the development and maintenance of MarkText, funding online and offline activities, and acquiring other necessary resources. Names and company logos of all sponsors (from both Patreon and Open Collective) will appear on the official website for MarkText and in its README.md file.

Special Sponsors

Platinum Sponsors

Gold Sponsors

Silver Sponsors

Bronze Sponsors

Backers

Screenshot

Features

  • Realtime preview (WYSIWYG) and a clean and simple interface to get a distraction-free writing experience.
  • Support CommonMark Spec, GitHub Flavored Markdown Spec and selective support Pandoc markdown.
  • Markdown extensions such as math expressions (KaTeX), front matter and emojis.
  • Support paragraphs and inline style shortcuts to improve your writing efficiency.
  • Output HTML and PDF files.
  • Various themes: Cadmium Light, Material Dark etc.
  • Various editing modes: Source Code mode, Typewriter mode, Focus mode.
  • Paste images directly from clipboard.

🌙themes🔆

Cadmium Light Dark
Graphite Light Material Dark
Ulysses Light One Dark

😸Edit modes🐶

Source Code Typewriter Focus

Why make another editor?

  1. I love writing. I have used a lot of markdown editors, yet there is still not an editor that can fully meet my needs. I don't like to be disturbed when I write by some unbearable bug. MarkText uses virtual DOM to render pages which has the added benefits of being highly efficient and being open source. That way anyone who loves markdown and writing can use MarkText.
  2. As mentioned above, MarkText is completely free and open source and will be open source forever. We hope that all markdown lovers will contribute their own code and help develop MarkText into a popular markdown editor.
  3. There are many markdown editors and all have their own merits, some have features which others don't. It's difficult to satisfy each markdown users' needs but we hope MarkText will be able to satisfy each markdown user as much as possible. Although the latest MarkText is still not perfect, we will try to make it as best as we possibly can.

Download and Installation

platform

latest version latest version latest version

Want to see new features of the latest version? Please refer to CHANGELOG.

macOS

You can either download the latest marktext-%version%.dmg from the release page or install MarkText using homebrew cask. To use Homebrew-Cask you just need to have Homebrew installed.

brew install --cask mark-text

Windows

Simply download and install MarkText via setup wizard (marktext-setup-%version%.exe) and choose whether to install per-user or machine wide. Alternatively, install MarkText using a package manager such as Chocolatey or Winget.

To use Chocolatey, you need to have Chocolatey installed:

choco install marktext

To use Winget, you need to have Winget installed:

winget install marktext

Linux

Please follow the Linux installation instructions.

Other

All binaries for Linux, macOS and Windows can be downloaded from the release page. If a version is unavailable for your system, then please open an issue.

Development

If you wish to build MarkText yourself, please check out our build instructions.

If you have any questions regarding MarkText, you are welcome to write an issue. When doing so please use the default format found when opening an issue. Of course, if you submit a PR directly, it will be greatly appreciated.

Integrations

  • Alfred Workflow: A Workflow for the macOS app Alfred: Use "mt" to open files/folder with MarkText.

Contribution

MarkText is in development, please make sure to read the Contributing Guide before making a pull request. Want to add some features to MarkText? Refer to our roadmap and open issues.

Contributors

Thank you to all the people who have already contributed to MarkText[contributors].

Special thanks to @Yasujizr who designed the MarkText logo.

License

MIT.

FOSSA Status

muya's People

Contributors

bensengupta avatar chungzh avatar dependabot[bot] avatar fxha avatar gideonsenku avatar hyfree avatar jocs avatar neopostmodern avatar yfwz100 avatar zeng1998 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

muya's Issues

Auto pair `*` and `{` is not work

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug
Auto pair markdown stytax are not work.

To Reproduce
Steps to reproduce the behavior:

  1. input foo
  2. input a *, and the text is foo*|*
  3. input * again, and the text is foo**|

Expected behavior
The close * is auto generated.

Actual behavior
The text is foo***|

Operation System and Browser version (please complete the following information):

  • OS: [e.g. macOS 13.5 (22G74)]
  • Browser: [e.g. Chrome 116.0.5845.110 (arm64)]

Muya Version
e.g: 0.2.1

Muya & nodejs

The readme.md says that Muya is not ready for production status, but at the same time MarkText is using it, and it seems quite stable, but that is using ES6. Is Muya still dependent on Electron today?

Second, in MarkText, Muya is in a subdirectory. However, it is using resources that are in the node_modules. The document says "Muya is available as a stand-alone library" but am I right to interpret this as a "stand-alone library that uses nodejs"? I am asking because I am looking to isolate Muya from MarkText, and am trying to understand its dependencies.

Thanks.

CodeBlock language input area is not clickable

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug
Create a code block, and click the language input

To Reproduce
Steps to reproduce the behavior:

  1. Create a code block
  2. Click the language input area

Expected behavior
The language input area is focused

Actual behavior
The language input area is not clickable.

Operation System and Browser version (please complete the following information):

  • OS: [e.g. macOS 13.5 (22G74)]
  • Browser: [Firefox]

Muya Version
e.g: 0.10.11

How to add shortcut keys?

I want to be able to add command + 1... to replace the default browser shortcuts, I see quickInsert has a description, but I can't find where to set it.

The menu cannot be displayed correctly when the text is selected in the safari browser

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug
The menu cannot be displayed correctly when the text is selected in the safari browser

To Reproduce
Steps to reproduce the behavior:

  1. typing some text
  2. Select some text

Expected behavior
The tool menu is displayed correctly

Actual behavior
tool menu icon not showing

Operation System and Browser version (please complete the following information):

  • OS: macOS 13.5
  • Browser: Safari 16.6

Muya Version
master branch

Screenshots / Screencasts(Optional)

截屏2023-08-31 18 57 08

Sample Markdown File((Optional))
None

Additional context((Optional))
None

your npm package is mistake

{
  "name": "muya",
  "version": "0.1.2",
  "description": "A browser based markdown editor that powers Mark Text",
  "main": "dist/muya.min.js",
  "scripts": {
    "test": "npm run test"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/marktext/muya.git"
  },
  "keywords": [
    "markdown",
    "editor",
    "brower"
  ],
  "author": "[email protected]",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/marktext/muya/issues"
  },
  "homepage": "https://github.com/marktext/muya#readme",
  "__npminstall_done": "Wed Sep 04 2019 01:46:35 GMT+0000 (GMT)",
  "_from": "[email protected]",
  "_resolved": "https://registry.npm.taobao.org/muya/download/muya-0.1.2.tgz"
}

could not found "dist/muya.min.js"
the main should be "dist/index.min.js"

Can not check the task list item

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug
Can not check the task list item.

To Reproduce
Steps to reproduce the behavior:

  1. Create a task list
  2. Click the checkbox of the task list item

Expected behavior
The task list item can be checked and unchecked.

Actual behavior
Nothing happened.

Operation System and Browser version (please complete the following information):

  • OS: [e.g. macOS 13.5 (22G74)]
  • Browser: Firefox

Muya Version
e.g: 0.10.11

Editor uses a very large horizontal space

The editor area behaves different on Chrome and Firefox. Chrome has no additional horizontal space but Firefox use a scrollbar and jumps e.g. on / input to the right that the editor is not in view-port.

Please provide TypeScript definitions

Muya (Mark Text's backend) is still in development but it would be a good idea to provide TypeScript definitions for high level APIs for easy integration.

Functions are undefined

  • Searched existing issues to avoid creating duplicates.
  • Confirmed that it can be reproduced in muya.

Describe the bug
All of the functions on an instantiated Muya are undefined. Below is just one example, I inspected the object and all functions are undefined.

To Reproduce

import Muya from '@marktext/muya';
import { useEffect, useRef } from 'react';

const RichMarkdownEditor = ({
  markdown,
  onBlur,
}: {
  markdown: string;
  onBlur: (value: string) => void;
}) => {
  const muyaContainer = useRef<HTMLDivElement | null>(null);

  useEffect(() => {
    if (!muyaContainer.current) {
      return;
    }

    const muya = new Muya(muyaContainer.current);
    muya.setContent(markdown);
  }, [muyaContainer]);

  return <div ref={muyaContainer}>Muya editor loading...</div>;
};

export default RichMarkdownEditor;

Upon execution you immediately get "TypeError: muya.setContent is not a function"

Expected behavior
Use the functions.

Actual behavior
Error is thrown.

Operation System and Browser version (please complete the following information):

  • OS: Ubuntu 22.04
  • Browser: Firefox 119 (x86)

Muya Version
0.2.5

Code block cursor confusion problem

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug
Typing too fast in a codeblock causes a cursor error

To Reproduce
Steps to reproduce the behavior:

  1. Create a javascript code block
  2. type JS codes bellow:
const a = '4'
function add(){}

Expected behavior
The code is entered normally

Actual behavior

Uncaught DOMException: Index or size is negative or greater than the allowed amount

Operation System and Browser version (please complete the following information):

  • OS: [e.g. macOS 13.5 (22G74)]
  • Browser: firefox only

Muya Version
e.g: 0.10.11

Can not input code in code block

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug
Enter the code in the code block and report an error

To Reproduce
Steps to reproduce the behavior:

  1. Create a code block
  2. Input code bellow
function add(a, b) {
    return a + b;
}

Expected behavior
Codes are display in codeblock corectlly.

Actual behavior

Error happened:

Index or size is negative or greater than the allowed amount
select@http://localhost:3000/main.bundle.js:63694:15
setCursor@http://localhost:3000/main.bundle.js:63794:14
setSelection@http://localhost:3000/main.bundle.js:63671:14
setCursor@http://localhost:3000/main.bundle.js:55642:24
inputHandler@http://localhost:3000/main.bundle.js:3188:12
eventHandler@http://localhost:3000/main.bundle.js:6160:25

Operation System and Browser version (please complete the following information):

  • OS: [e.g. macOS 13.5 (22G74)]
  • Browser: firefox

Muya Version
e.g: 0.10.11

Press delete key in code block language input and cause bug

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug
Create a code block, and edit the language input, and press delete key, then will cause bugs.

To Reproduce
Steps to reproduce the behavior:

  1. Create a Code Block.
  2. Click in the language input area.
  3. Press delete key

Expected behavior
Nothing will hapen when the cursor is at the end input area.

Actual behavior
Pressing the delete key continuously causes the code block to no longer be editable

Operation System and Browser version (please complete the following information):

  • OS: macOS
  • Browser: Chrome

Muya Version
e.g: 0.10.11

Forked codebases between this repo and marktext

Looking to potentially adopt this as a dependency, it's a bit concerning that there seem to be two parallel copies of muya right now, here and within the marktext repository.

Are there plans to eventually switch Marktext to relying on releases from this repository, or are there hard reasons they need to stay forks?

What does development on muya look like? Does it mostly happen first in Marktext and then improvements/fixes get backported to Muya as needed? It looks like that from Muya's history, but I'm wondering if there's any regularized process yet for if/when changes to marktext/muya get ported to muya

This might be good stuff to elaborate on in Muya's FAQ

Using Muya with react throws error

Hello, Loved marktext and wanted to use Muya in my current project for markdown support.
Currently my project is a simple create-react-app where I am trying to use muya I went through the doc and getting the below error can someone help me

image

I have already installed it so not sure what is the issue

BTW love MarkText and muya will be a killer if I can contribute in some way please let me know I will be happy to contribute maybe some small issue

[Feature] idea of GUI


  • [ x] Searched existing issues to avoid creating duplicates.

Why you want this feature?
We should have an idea of GUI from muya, zettlr is a good starting point in my opinion.
image

Describe the feature request
We should create a list of ideas and sketches of applications

Additional context
zwttlr

[BUG?] Use `ctrl+A` to select all need press twice

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug
need press ctrl+A twice to select all contents.

To Reproduce

  1. git clone the latest commit of the repo (version 0.2.5)
  2. run pnpm dev
  3. visit http://localhost:5173
  4. press ctrl+A, but fail to select all.
  5. press ctrl+A again, success.

Expected behavior
press ctrl+A once to select all content.

Actual behavior
need press twice to do that.

BTW, is it possible to controll to copy the rich text or the plain markdown text of the selection.

Operation System and Browser version (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome 121.0.6167.86 (Official Build) (64-bit)

Muya Version
e.g: 0.2.5

Screenshots / Screencasts(Optional)

github

Code block cursor confusion problem when `backspace`

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug
If the backspace is preceded by a newline character, it will result in an error.

To Reproduce
Steps to reproduce the behavior:

  1. Create javascript code block
  2. Input codes bellow
function add(){

}|
  1. The cursor is at the end of function add
  2. Press backspace

Expected behavior
Input normally.

Actual behavior
The cursor flies inside the topmost code

Operation System and Browser version (please complete the following information):

  • OS: [e.g. macOS 13.5 (22G74)]
  • Browser: firefox only

Muya Version
e.g: 0.10.11

The image can not be edit

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug
After selecting the picture, click Edit, the image editing panel appears, the input box gets the cursor, and the backspace button is clicked, which cannot delete the src content, but deletes the content in the file

To Reproduce
Steps to reproduce the behavior:

  1. Select one image in document.
  2. Click edit button
  3. Put cursor in the input area
  4. Press the backspace key.

Expected behavior
The src of image is deleted one by one (char)

Actual behavior
The content of the document are deleted.

Operation System and Browser version (please complete the following information):

  • OS: [e.g. macOS 13.5 (22G74)]
  • Browser: [e.g. Chrome 116.0.5845.110 (arm64)]

Muya Version
e.g: 0.10.11

Screenshots / Screencasts(Optional)
截屏2023-09-22 21 34 26

Code Editor Integration

Would it be possible to make this real time preview markdown editor usable within Code Editors such as Atom or VS Code?

How to use example html?

I don't understand how should I use example index.html: there is no js in it, and it just don't do anything? I tried adding

<script src="index.js"></script>

in it but nothing changed, I can write anything in the textboxes and click any button, but nothing happens at all

Multiple instances of Muya.

Love the Muya so far!

I want to be able to have multiple instances of the editor on a single page. Will this be possible in the future? Any ideas how would I go about it?

Thanks!

Paste doesn't work in Firefox

Try to paste content, but an exception occurs with Firefox:

Uncaught (in promise) TypeError: path is undefined
    getTargetBlock index.js:40
    pasteHandler paste.js:22

Browser: Firefox (works in Chrome)

Can not input text in Firefox

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Create a paragraph
  2. Input some text e.g. "foo bar"

Expected behavior
Everything is OK, and the input text is shown in the browser

Actrral behavior
The error is happened: "Intl.Segmenter is not a constructor"

Operation System and Browser version (please complete the following information):

  • OS: [e.g. macOS 13.5 (22G74)]
  • Browser: Firefox

Muya Version
e.g: 0.10.11

NPM Package Support

I'm going to use muya in my Electron application, but the muya package that published on npm has not updated until last year, so I have to copy the muya folder from marktext project. I reckon that is so sophisticated to use muya.
This is the application that use muya as preview editor Memocast

prismjs import error - require is not define

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug

When I integrated "muya" into my project, the following error occurred (I'm using the latest version of npm - "@marktext/muya": "^0.2.1",).

This seems to be a common error with Vite.

Unknown variable dynamic import: ../../../node_modules/prisms/components/prism-latex.js te: July at eval (webpack-internal:///../muya/dist/chunks/emptyStates. cbb949b2.js:2179:86)

Unknown variable dynamic import: ../../.. /node_modules /prismjs/components/prism-yaml.js

require is not defined
ReferenceError: require is not defined
at eval (webpack-internal:/// ../muva/dist/chunks/prism-keep-markup.6f6991cb.is:2:1)
at . . /mua/dist/chunks/prism-keep-markup.6f6991cb.js(http://localhost:3000/js/muya_dist_chunks_prism-keep-markup_6f6991cb_js.js:18:1)
at webpack_require.
(http://localhost:3000/js/app.is:737:33)
at Function. fn (http://localhost:3000/js/app.js: 1110:21)

To Reproduce
Steps to reproduce the behavior:

import Muya from '@marktext/muya';
import {
  EmojiSelector,
  InlineFormatToolbar,
  ImageEditTool,
  ImageToolBar,
  ImageResizeBar,
  CodeBlockLanguageSelector,
  TableColumnToolbar,
  ParagraphQuickInsertMenu,
  TableDragBar,
  TableRowColumMenu,
  PreviewToolBar,
  ParagraphFrontButton,
  ParagraphFrontMenu,
} from '@marktext/muya/dist/ui/index';

Expected behavior
A clear and concise description of what you expected to happen.

Actual behavior
The actual result of this bug

Operation System and Browser version (please complete the following information):

  • OS: macOS Ventura 13.6
  • Browser: [ Chrome Version 116.0.5845.187 (arm64)]

Muya Version
"^0.2.1"

Using Muya without Vue/ES6

Hi, I’m wondering how to use the Muya library from the Marktext repository only using JavaScript, and not Vue & ES6. The main reasons being I’m relatively new to JS and the app I’m trying to build is pretty simple.

I’ve tried following the Muya example included in Jocs’s GitHub repository and looked at files given in this repository, but got stuck importing modules like TablePicker such as here,

Muya.use(TablePicker)

since it seems import TablePicker is specific to Vue/ES6, and does not work as a module in Chrome. This issue also occurs in each modules’ index.js files since the import statements also follow that formatting.

I’ve tried building the index.min.js from scratch using the web pack config; and as a result get that file along with a bunch of x.index.js files — this seems similar to the chunks in the Muya example?

If this is not an appropriate topic, I apologize and will try to seek help elsewhere.

The cursor is wrong when use `backspace` to delete some text

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug
When deleting text via the backspace key, the cursor is scrambled if the text is adjacent to the inline style

To Reproduce
Steps to reproduce the behavior:

  1. Input text **hello**|
  2. Press backspace key twice

Expected behavior
The text should be like this: **hello|

Actual behavior
The text become this: **|hello, the | is cursor position.

Operation System and Browser version (please complete the following information):

  • OS: [e.g. macOS 13.5 (22G74)]
  • Browser: Firefox

Muya Version
e.g: 0.10.11

Code Block Issue

Problem :

I always get this error message

image

when I paste a code blocks like this

2020-04-19_18-30-30

It seems from this line

src\muya\lib\selection\index.js : 344

  select (startNode, startOffset, endNode, endOffset) {
    const range = this.doc.createRange() 
    range.setStart(startNode, startOffset) <-- This Line
    if (endNode) {
      range.setEnd(endNode, endOffset)
    } else {
      range.collapse(true)
    }
    this.selectRange(range)
    return range
  }

Replace image and cause error

  • Searched existing issues to avoid creating duplicates.

  • Confirmed that it can be reproduced in muya.


Describe the bug

Cannot read properties of undefined (reading 'replaceImage')
TypeError: Cannot read properties of undefined (reading 'replaceImage')
    at ImageSelector.replaceImageAsync (http://localhost:3000/main.bundle.js:64844:32)
    at ImageSelector.handleLinkButtonClick (http://localhost:3000/main.bundle.js:65207:21)
    at Object.click (http://localhost:3000/main.bundle.js:64954:34)
    at invokeHandler (http://localhost:3000/main.bundle.js:46473:17)
    at handleEvent (http://localhost:3000/main.bundle.js:46487:9)
    at HTMLButtonElement.handler (http://localhost:3000/main.bundle.js:46492:9)

To Reproduce
Steps to reproduce the behavior:

  1. Insert an image
  2. Click the image edit button
  3. Input a new image url, and click the confirm button
  4. See error

Expected behavior
New image to replace the old image and show in the editor

Actual behavior
Error happened.

Operation System and Browser version (please complete the following information):

  • OS: [e.g. macOS 13.5 (22G74)]
  • Browser: [e.g. Chrome 116.0.5845.110 (arm64)]

Muya Version
e.g: 0.10.11

Additional context((Optional))
Add any other context about the problem here.

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.