question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Markdown to HTML for blog page.

See original GitHub issue

I get the editor has a preview feature but what I’m after is if it offers a function to just output the markdown to HTML.Much like editing a blog post saving the markdown to the database then rendering the markdown as HTML on the client.

The function is like marked.js do ,I find it is hard to render same html page like that easyMDE render preview when try to include marked.js ,the differrence is feature code and poetry.Furthermore Blockquotes of easyMDE don’t have solid border-left like simplemde markdown editor.

My Demo

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Example / Preview</title>
    <link rel="stylesheet" href="https://unpkg.com/easymde/dist/easymde.min.css">
    <script src="https://unpkg.com/easymde/dist/easymde.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
</head>

<body>
    <section class="main-content">
        <h1><a id="h1_demo1" class="anchor" aria-hidden="true"></a>Demo</h1>
        <button onclick="myFunction()">Click me</button>
        <textarea id="demo1" style="display: none;"># Hello world</textarea>
    </section>
    <div id="content"></div>

    <script>
    var easyMDE = new EasyMDE({
        element: document.getElementById("demo1"),
        spellChecker: false,

    });


    function myFunction() {
        var str = easyMDE.value();
        //var str = document.getElementById("demo1").innerHTML;
        document.getElementById('content').innerHTML = marked(str);
    }
    </script>
</body>

</html>

Seems like something that should be included…

Reply appreciated.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
r-hannuschkacommented, Sep 30, 2020

What we use was very simple:

const easyMDE = new EasyMde( ... );
easyMDE.markdown(easyMDE.value());

this returned the html code from markdown

1reaction
donatellofangcommented, Oct 9, 2020

What we use was very simple:

const easyMDE = new EasyMde( ... );
easyMDE.markdown(easyMDE.value());

this returned the html code from markdown

The returned html code has no css class style like easyMDE‘s preview mode which include blockquote and code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a Markdown Blog Powered by Next.js in Under an Hour
Get started with Next.js with this step-by-step tutorial.
Read more >
Write technical tutorials in style! How to take advantage of ...
Build a tutorial blog with React and Markdown. Enhance your blog's user ... In short, it's a software tool that converts the language...
Read more >
Distill for R Markdown: Creating a Blog - GitHub Pages
html will be included in both the sidebar of the main listing page as well as in the footer of articles. Note that...
Read more >
Static Blog With Next.js and Markdown - YouTube
Create a basic blog using Next.js and Markdown.Code: https://github.com/bradtraversy/next- markdown -blogDemo: ...
Read more >
08 Rendering the Markdown as HTML in the blog detail page
In this video, we are going to look at how we can render the Markdown coming from the API into proper HTML on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found