MarkDown configured to use the rich text editor in Asp.Net or open-source .Net Core in template code (code .net core3.0 version)

How to use Markdown you may take several days to get, but look at my article or download the source code, you usually get in within 10 minutes. I would let you introduce it:

Markdown is a lightweight markup language that allows people to write documents using easy to read and write plain text format. Markdown language in 2004 by John Gruber: create (English John Gruber). Documents written in Markdown can export documents in multiple formats HTML, Word, image, PDF, Epub and so on. With its increasingly popular our site naturally not fall behind, then I will teach you how to configure it to use!

Achieve results shown in Figure:

1. The first thing you want to refer to markdown documentation library ( open source projects address )

 

 

 

<link href="~/Lib/MarkDown/css/editormd.css" rel="stylesheet" />
<link href="~/Lib/MarkDown/css/editormd.preview.css" rel="stylesheet" />
<script src="~/Lib/MarkDown/js/editormd.js"></script>

2.html added editor (loaded only on the data to be loaded into the editor textarea tag)

<div id="test-editormd">
        <textarea id="articleContent" style="display: none;">@Html.Raw(Model.Context)</textarea>
    </div>

3. Set initialize (temporarily at this time to teach you to upload pictures, I want to know look behind the blog description)

$(function () {
        testEditor = editormd("test-editormd", {
            width: "99%",
            height: 640,
            syncScrolling: "single",
            path: "/Lib/MarkDown/lib/",
            saveHTMLToTextarea: true,
            emoji: true
        });

    });

4. Obtain data retention

function btnSave() {
        Alert ( " HTML Data: " + testEditor.getHTML ());
        Alert ( " Markdown data: " + testEditor.getMarkdown ());
         // save you enough to save the text as needed. 
    }

 

Open source address  Dodo little hands, a point recommend it!

 

Note: We have the opportunity to house the project will provide long-term asp.net core demo a variety of easy to use for everyone, .net developers to help improve competitiveness and speed of development, the proposed collection as soon as the template collection item .

Guess you like

Origin www.cnblogs.com/jiyuwu/p/11791004.html