Markdown to HTML for blog page.
See original GitHub issueI 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:
- Created 3 years ago
- Reactions:3
- Comments:9 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
What we use was very simple:
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.