Giter Site home page Giter Site logo

ionaru / easy-markdown-editor Goto Github PK

View Code? Open in Web Editor NEW
2.3K 25.0 301.0 12.94 MB

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.

Home Page: https://stackblitz.com/edit/easymde

License: MIT License

CSS 6.16% JavaScript 86.81% TypeScript 4.68% HTML 2.35%
markdown-editor markdown markdown-to-html markdown-converter markdown-viewer markdown-parser

easy-markdown-editor's Introduction

Hi there, I'm Jeroen 👋

Full-stack developer, Scrum Master, Frontend specialty.

LinkedIn StackOverflow Discord Steam


I'm an ambitious full-stack developer and Scrum Master from the Netherlands that specialises in frontend, however I do not shy away from non-web programming.

About me

Timezone: Europe/Amsterdam



  • 🔭 I'm currently working on: Migrating a legacy JS codebase to modern ESM
  • 🌱 I'm currently learning: How microservices communicate with each other.
  • 💬 My interests: Board games, transportation, hiking in the mountains
  • 📫 How to reach me: LinkedIn or Discord


My favourite languages, frameworks, databases and tools

HTML5 CSS3 Sass JavaScript Typescript PHP Python
Angular Vue.js Jest Ionic NestJS Laravel
MySQL SQLite PostgreSQL Redis Mongo DB
Visual Studio Code IntelliJ IDEA Ultimate Git GitHub Docker



easy-markdown-editor's People

Contributors

7upcat avatar a-312 avatar adam187 avatar adamb70 avatar brondsem avatar cbadke avatar danice avatar dependabot[bot] avatar dima-bzz avatar fabiankoestring avatar firm1 avatar frm avatar ggtmtmgg avatar ionaru avatar ivictbor avatar jecsham avatar kolaente avatar lukasz89 avatar nick-denry avatar nofxx avatar roipoussiere avatar roryok avatar situphen avatar smundro avatar trwired avatar vanillajonathan avatar wescossick avatar whiterm avatar zignature avatar zsgsdesign 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  avatar  avatar  avatar

easy-markdown-editor's Issues

Impossible to navigate cursor on Mobile

Impossible to navigate cursor on Mobile

Hey Guys,

I'm having issue with easy-markdown implementation for responsive version of the editor on mobile, So after adding some text if you move around the the texts it starts blinking on a word and make it impossible to move around any further.

Steps:

  • Open text editor on mobile
  • Add some long text
  • Try to navigate around through cursor
  • Repeat it for a while until a word gets highlighted and starts blinking
  • After that you wont be able to navigate around the text properly

Please if anyone can guide me on this.

Programatically set preview

I'm submitting a...

  • [] Bug report
  • Feature request

Version information

Browser type and version:
EasyMDE version: 4

Im curios how i can set the editor to render in preview mode? I only want the editor to be editable when the admin is using it, other users should only see the preview

Add ability to pass `spellcheck` and `inputType` options to CodeMirror

I'm submitting a...

  • Feature request

After adding

inputStyle: "contenteditable",
spellcheck: true

to the CodeMirror initialisation at https://github.com/Ionaru/easy-markdown-editor/blob/master/src/js/easymde.js#L1584, I was able to get spellchecking within the browser (at least Google Chrome) functional without any apparent issues. If we could pass these options (or arbitrary options that just had defaults) to the CodeMirror initialisation, that would be awesome.

PS. Thanks so much for this fork of simplemde. It powers our internal CMS and our staff love using it.

Blockquote double enter not removing stay >

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

When doing a block quote, i hit enter twice, I expect the last one to disappear i.e.

> fubar
>
qqeqweqw

You end up with a stray >

Lists work fine, just blockquote

IE11 - mouse slection not working

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

  1. Open browser.
  2. Type several paragraphs.
  3. Try selecting one of the paragraphs in IE11.
  4. Kick yourself in the nutsack.
  5. Load up https://simplemde.com/ in the same browser
  6. Successfully select any paragraph you want.
  7. Kick yourself in the nutsack.
  8. Ponder what may have introduced this odd bug.

https://jsfiddle.net/vo1g3kue/

Version information

Browser type and version: IE 11.471.17134.0
EasyMDE version: any?

Easy way to redefine an action?

I'm submitting a...

  • Bug report
  • Feature request

I would like to redefine some actions. The only way I found to do this is to use the toolbar option, but this one overwrite all default items, so I need to set all default icons and create a new icon with the same values instead the custom action, like this:

toolbar: [
    'bold', 'italic', 'heading', '|', 'quote', 'unordered-list', 'ordered-list', '|', 'link',
    {
        name: 'image',
        action: function customFunction(editor){
            alert('Hey!')
        },
        className: 'fa fa-image',
        title: 'Insert image'
    },
    '|', 'preview', 'side-by-side', 'fullscreen', 'guide'
]

Is there an easier way to do this?

If not, I would suggest a toolbarAction option, which could work like this:

new EasyMDE({
    toolbarAction: {
        image: function customFunction(editor){
            alert('Hey!')
        },
    }
});

Don't commit dist folder?

I don't find how is that useful to commit the dist folder, since it's generated with gulp.

Some drawbacks:

  • redundancy;
  • always creates conflicts, so many pull-requests can not be merged automatically and it makes the update more difficult, so it's annoying both for maintainers and developers;
  • we are never really sure that the files in the dist folder are consistent with the sources before to run gulp;
  • this make the git history huge.

Apply custom class to string

I'm submitting a...

  • Question

Reproduction steps

I'm looking the way to highlight some text in the editor, for example when I write ???category I want to apply some CSS style to that part of the text, it's possible ?
Thank you!

EDIT:
Here some code for what I want to do, for example if I write &Hello the text parsed and styled to

<span class="cm-formatting cm-my-style1">&</span>
<span class="cm-my-style2">Hello</span>

Breaking change with SimpleMDE in toolbar icons

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

When passing custom toolbar icons, the no-disable class previously used in SimpleMDE is not respected.
Check this JSFiddle: https://jsfiddle.net/myv5wgh0/.

Due to a change in early v2 (7b147b3#diff-510834ebe67771ad1adc3336cb7fd314R16116), element.classList is now used instead of the element.className previously in use which results in a loss of classnames.

Also, the changes in v2 resulted in changes in the shape of the toolbar objects, which makes it a breaking change with SimpleMDE (need to add the noDisableproperty in EasyMDE).

So, no big bad breaking change, but I think it's worth mentioning it.

I found this "bug" because in a project of ours we use a different set of toolbar icons (material) and we needed to customize the actions.

Version information

EasyMDE version: >2.0.0

heading-smaller, heading-bigger, heading-1, 2, 3 - using wrong css class?

Seems all these icons are using fa-header which doesn't exist in FontAwesome.
Should they also have fa-heading?

Displaying those buttons by default will result in the FontAwesome 'missing icon question mark' displaying instead.

On a similar note, the "H1, H2, H3" is currently added using css :after, but FontAwesome 5 has inbuilt support for fa-h1, etc, which looks cleaner.

Add checklist toolbar button

I'm submitting a...

  • Feature request

It would be great to have another type of list (in addition to generic and numbered) that starts each line with - [ ] for easy building of to-do lists and other such things.

Newlines not being displayed when setting value

When setting the value to a markdown string that includes newline characters the entire string is displaying as one line when using myEditor.value('myMarkdownString').

Either I'm doing it wrong or it's not parsing the newlines correctly. Any help appreciated

EasyMDE version: 2.5.1

Editing without viewing the markdown ?

It would be great to have a mode, like preview - but with editing.

Some of my users are non-technical, so I could show them a version of the editor that doesn't have the markdown available.

spell checker

is codemirror-spell-checker really necessary?
it brings in lots of other dependencies i don't want/need (it seems to only be english wish my website don't use).

I think it should be an optional dependency. Also, isn't possible to use the native spell checker somehow?

(related: cfinke/Typo.js#68, cross-js#dont-use-buffer)

Fix word count for words with German Umlauts and ß

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

  1. Set the editor's text input to this fictive German example text: "Öffentliche Apfelbäume wären schön für die Bürger, denn selbst mit ein wenig Übung würden die höchstgelegenen Äpfel außerordentlich schnell gepflückt werden."
  2. EasyMDE counts 30 words.
  3. It's actually 21 words.

or

  1. Change the text to: "Öffentliche Äußerungen werden manchmal ohne große Überlegung übernommen und ähnlich öffentlich wiedergegeben."
  2. EasyMDE counts 14 words.
  3. It's actually 12 words.

or

  1. Change the text to: "Üa Öa Üa aü aä aö aß ßß ßa"
  2. EasyMDE counts 8 words.
  3. It's actually 9 "words", "ßß" is not counted.

Version information

EasyMDE version: 2.5.1

Unicode sequences

Ä = \u00c4
Ö = \u00d6
Ü = \u00dc
ä = u00e4
ö = \u00f6
ü = \u00fc
ß = \u00df

API hooks for image/file uploading

I'm submitting a...

  • Feature request

We would like to give our users the ability to upload images and files, and I think that GitHub has solved this really nice. In order to implement this, I would love it if there was some way to register hooks for when a file is dropped onto the editor.

To be clear, I would not like the editor to do anything regarding the actual uploading of the files. Just a hook that calls my own function when a file has been dropped.

My own code could then upload the file, and insert the correct markdown syntax for it to be displayed ☺️

I'd be happy to help contribute code for this, please let me know what you think!

Android Mobile Text Input

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

User a Android device and start typing. Each character is on a new line

Version information

Browser type and version: Chrome, Firefox on Android
EasyMDE version: 2.1.0

Custom autosave handler

I'm submitting a...

  • Bug report
  • Feature request

The current autosave feature periodically stores contents to the local storage. It would be great if a function for autosave can be passed to option so that the autosave handler may be overridden for feature like server-side autosave,

New line after list

I'm submitting a... Bug report..

Reproduction steps

I am using it as a replacement for simplemde.

  1. There is a difference in markdown rendering in preview mode when using list. The very next line (dont have to leave any blank space), in preview mode is rendered differently. The content of next line shows up on last line of list (ignoring \n)
  2. Also markdown is also a bit different. (On Simplemde, we had markdown \r\n on new line but on this version, its only \n

Version information

Browser type and version: Chrome
EasyMDE version: v2.1.0

Disable EasyMDE inside form

I'm submitting a...

  • [] Bug report
  • Feature request

Version information

Browser type and version: latest Chrome
EasyMDE version: 2.5.1

Hi, thank you for the awesome plugin and big thanks for the regular updates.

I'm here to ask you about "disabling" feature. I've used your plugin in Formik (Reactjs) and in some cases, I should disable all fields in the form and EasyMDE too.

My feature request is: Can we have "disable" option or not.

Thank you.

Font Awesome 5 Needs 'far' or 'fas' classes, not 'fa'

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

  1. install EasyMDE on a site that already uses FontAwesome, and thus doesn't pull the loaded one
  2. Look at toolbar's missing icons

Version information

Browser type and version:
EasyMDE version: 2.4.1

Font Awesome 5 has changed the way they do their classing from Font Awesome 4. No longer can you simply use fa, rather you need to use fas, far, etc... It appears that your autoloaded version actually uses FA 4.7.0, does not behave this way, so when using EasyMDE on a site that already uses FontAwesome 5, the icons do not show.

It seems to me that the solution is to simply add far or fas to the corresponding icon classes, as it won't affect people who still use FA4, and the extra fa won't affect people using FA5.

Before- and afterRender functions

I'm submitting a...

  • [] Bug report
  • [x ] Feature request

Reproduction steps

It would be nice if there was a possibility to have functions that are called before and after the rendering of the preview render function. It creates a possibility to render custom text within the preview without me having to also to the markdown rendering, i.e. think of having mentions inside the text.

Can not select text on mobile

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

  1. Double tap on a word to select it
  2. It selects it and deselects it, making it impossible to select text

Version information

Browser type and version: Latest Android Chrome
EasyMDE version: Latest from unpkg

This also happens on the demo version of EasyMDE.

Include typings

I'm submitting a...

  • Bug report
  • Feature request

The typings from here should be adapted for EasyMDE and included in this repo.

Add type="button" to toolbar buttons

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

Please add role="button" to toolbar buttons. Otherwise they are by default treated as submit buttons which causes weird behaviour when SimpleMDE is inside a form with other inputs. Instead of submitting the form when I press <enter>, first button (SimpleMDE's bold button) is pressed.

See this fiddle: https://jsfiddle.net/ge9hfkaL/2/

Version information

Browser type and version: all?
EasyMDE version: all?

Change role="button" to type="button" on toolbar buttons

I am sorry, a created issue #38, to fix weird behaviour when submitting form via ENTER key. After testing with new release bug mentioned in #38 still occurring, so after futher googling and this time also testing I found you have to set type="button" not role="button"

Cannot bundle code with webpack that imports EasyMDE

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

  1. npm install easymde --save
  2. Added import EasyMDE from 'easymde'
  3. Compiled the component that imports it using webpack

Version information

Node: 8.9.4
NPM: 5.6.0
EasyMDE version: 2.0.1

Issue:
I currently have webpack set up as my app's bundler, and I've had no problems so far with any other modules, but after installing and trying to use easymde, babel-loader freaks out and says it cannot find the module, even though I confirmed it's present in node_modules. I tested with another module and it worked fine. Could it be because your package.json main field points to the dev build of the module?

Bug With unordered lists

When creating an unordered list like so:

- One
- Two

entering a newline at the end of line - One (i.e., inserting a new item between One and Two) results in the following:

- One
- 
NaNundefinedTwo

Note: This does not occur with ordered list. Also, the old SimpleMDE 1.11.2 doesn't have this problem.

Add Ability to preview without full screen

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

The editor currently forces the user to go full screen with codemirror when the side by side mode is enabled. It would be nice to be able to disable this functionality as it's fairly opinionated by the original devs.

A quick option and if check here would resolve this.

Feature: Pass own marked renderer

I'm submitting a...

  • Bug report
  • Feature request

Feature Request

I found this fork after going through the network on the original project and as stated in #1 you said that you planned to continue the development of the original project since it seems that the original has stopped.

As noted in the title I would like to pass my own markedjs renderer to simplemde for rendering the previews since marked is what does it in the first place. I think that this should be done with a config property like such:

// Init the default renderer
var renderer = new marked.Renderer();
// Custom table rendering (in this case bootstrap table)
renderer.table = function (header, body) {
     return `<table class="table">${header} ${body}</table>`
};
new SimpleMDE({
    element: document.getElementById('simplemde-box'),
    // Pass the custom renderer
    renderer: renderer
});

iOS Text Input Issue

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

  1. Get an iOS device (I am personally using an iPhone X)
  2. Open a browser of your choice (I used Safari and Chrome)
  3. Navigate to this JSFiddle
  4. Select the text input box
  5. Type

You will notice that the keyboard does not dynamically or automatically change. Ever. When you first tap on the text input box it should automatically be in Caps mode, and after typing a single character it should automatically become uncapitalised. This does not happen. Another issue double-tapping space does not produce a full-stop. If you need any reminder of how the keyboard should be behaving, just open the notes app and type for a bit.

I believe that it must be because the keyboard isn't able to find any information on the contents of the text input box, though I'm speaking with no knowledge in the area.

Note: If you remove show from the URL of the JSFiddle, it will take you to the code.

Version information

Browser type and version: Safari (latest version), Chrome (latest version)
EasyMDE version: 2.4.0

Would be great to get some information about this fork

Hi there, looks like you've been adding some good stuff to simplemde, while the main simplemde project hasn't been updated for 2 years (unless I'm reading it wrong). Any chance you could post some information about this fork? Thanks

Set sanitize marked option to true by default?

Many issues on simple-mde was about an XSS vulnerability, allowing the user to execute JS code in the preview.

While the never trust the user is a common practice in web development, I think that we should avoid this and set the marked sanitize option to true by default.

I don't really find use-cases where injecting JS in a markdown viewer is useful.

Note that of course we can easily set this option with renderingConfig like below, this issue is just about choosing the default behavior.

new EasyMDE({
    element: ...,
    renderingConfig: {
        markedOptions: {
            sanitize: true
        }
    }
});

I'm submitting a...

  • Bug report
  • Feature request

(well, not sure here...)

Reproduction steps

Just type this in the text area:

<div onclick="alert('oops!')">Click here, please</div>

Then activate the preview and click on the text.

Version information

Any browser, any version

Hyperlink text getting doubled each time click on link

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

  1. Navigate to editor and enter some link
  2. Select the link and click on link icon in header (multiple times)

Version information

Browser type and version: Chrome (Desktop) - Latest version
EasyMDE version: NA
2018-09-03_19-37-42

RFE: allow a callback for link generation

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

N/A

Version information

EasyMDE version: hopefully the next one ;)

i would like to have a callback (as part of the config options) which gets called when the editor/previewer wants to render a link. The callback should get the link URI and the label as arguments and should return the "rendered" form of the link as an HTML string (or, if the internal API supports it, as a DOM element - that would give us more flexibility). If the callback is not set, or returns the undefined value, the previewer should use its current default behaviour.

Concrete use case: i'd like to replace an old custom blog/wiki of mine which uses the Google Code Wiki format. It runs as a one-page app and loads new wiki pages (in the same app session) when a user clicks on a link to a wiki page (yet treats external links "as usual"). That is only possible because the Google Code Wiki parser allows me to replace (via a callback) its default link generator with one which i use to check "is this a link to a wiki page, and if so, create a custom link". Such a callback also makes it possible to replace anchor tags with, e.g., spans with on-click handlers, which might conceivably be useful as an anti-bot/spider method.

As an example:

https://fossil.wanderinghorse.net/wikis/cson

The "TableOfContents" link on the first page is a link to another wiki page, which the Google Code Wiki parser has allowed me to customize the link for. Tapping the link loads the requested page via ajax and feeds it into the app.

Relation to InscrybMDE

Hi, I've been looking for a (maintained) replacement to SimpleMDE and found this and InscrybMDE - what is the relation between the forks? I would really like to have my cake and eat it all :D

Bold, italic toggle at end of word causing issues.

I'm submitting a...

  • Bug report

Reproduction steps

  1. Place cursor at end of word and click bold multiple times like toggling. It adds multiple ** and activating italic instead of removing the initial bold **
    image

image

Version information

Browser type and version: Chrome Version 70.0.3538.77
EasyMDE version: 2.5.1

Unordered and ordered lists are combined

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

The minimal markdown input required to reproduce the bug is the following:

 - unordered
 1. ordered

It displays the following:

  • unordered
  • ordered

Github displays it correctly:

  • unordered
  1. ordered

Two newlines still counts as one list and displays the buggy behaviour:

 - unordered

 1. ordered

When there are three newlines, it stops exhibiting the behaviour:

 - unordered


 1. ordered

Version information

Browser type and version: Chrome, Version 72.0.3626.96 (Official Build) (64-bit)
EasyMDE version: Unsure, it is present on https://easymde.tk/

Include CSS directly from JavaScript

I'm submitting a...

  • [] Bug report
  • Feature request

Reproduction steps

  1. ...
  2. ...

Version information

Browser type and version: Chrome 65
SimpleMDE version: Latest

Description

Currently developers are forced to include the css file as an external link through HTML. In my opinion this is bad practice and should be rather packed with the module itself, so that whenever I require or import this module I don't need the extra link. In the meantime, it would be pretty useful to explicitly say so, cause as per docs you only need this when you include the module via CDNs.

CodeMirror.commands undefined when importing package

I'm submitting a...

  • Bug report
  • Feature request

Reproduction steps

  1. Install package npm install --save easymde
  2. Use webpack to bundle your js and point it to an entrypoint javascript file.
  3. Import it in your JS file import "easymde" or import { EasyMDE } from "easymde" or import * as EasyMDE from "easymde"
  4. Visit page that JS is loaded, it will say CodeMirror.commands is undefined in browser console.

If I import the minified js file (see below) it works fine, so I guess the issue is related to the bundling, perhaps some dependency or something that have to be set in the webpack config file that is not specified?

const EasyMDE = require('easymde/dist/easymde.min.js');

Version information

Browser type and version: Chrome/Firefox
EasyMDE version: 2.4.2

Split up toolbar button and icon classes

I'm submitting a...

  • Bug report
  • Feature request

While working on #41 I noticed it is necessary define button classes and icon classes in the same field, this is a result of changes made to have FontAwesome 5 compatibility.

This behaviour is confusing for developers working with the editor and error prone because the editor has to figure out which classes to add to the icon and which ones to add to the button.

I want to mark className as deprecated and introduce iconClass and buttonClass, those fields combined will facilitate the same functionality.

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.