WeChat mini-app rich text supports HTML and markdown parsing wxParseAlpha0.1

Source: Internet
Author: User
The rich text parsing custom component of the applet, which supports HTML and markdown parsing, may be the first rich text parsing component of the applet.
WxParse

The rich text parsing custom component of the applet, which supports HTML and markdown parsing, may be the first rich text parsing component of the applet.

I hope you can find the problem, submit the problem, or submit your modified code by using foke.

  • The project is currently only a test version and needs to be further improved

  • WxParse and wxss

  • Need to enhance markdown parsing html

  • Others

Composition
-WxParse -- wxParse. js (tool Portal output port) -- wxParse. wxml (Template File) -- wxParse. wxss (defines css)
Usage
  • Copy the entire folderwxParse/To the root directory

  • Apply a style filewxParse.wxssIntroduced to the scope of your calls to this plug-in.

    @ Import "your path/wxParse. wxss ";
  • In the templatex.wxmlIntroducing template fileswxParse.wxml

       
       
        
       
  • IntroducewxParse.jsFile

    Var WxParse = require ('Your path/wxParse. js ');
  • Set the corresponding data value arraywxParseData(WxParseData must be used) and

// Html parsing onLoad: function () {console. log ('onload') var html ='

WxParse-small program rich text parsing custom component, supports HTML and markdown parsing

Custom components for rich text parsing in applets, supporting HTML and markdown parsing

Function List
  • Dynamic code loading
  • Convert html to json
  • Markdown to convert html to json
  • Rich text markdown analysis
  • Custom level resolution
  • Custom style sheets
File function
// WxParse. wxml // template used for parsing. css {text-align: center ;}

Test p

Development Information

Applet Development Forum

! [] (Http://img.php.cn/upload/article/000/001/505/115945f096a6bba61f58be0b164de67b-1.png)

Applet logo

'; Var that = this // update the data that. setData ({wxParseData: WxParse ('html', html )})}
// Markdown parse onLoad: function () {console. log ('onload') var text = '# wxParse-small program rich text parsing custom component, support HTML and markdown parsing \ n' + '> small program rich text parsing custom components, support HTML and markdown parsing \ n \ n' + '# function list \ n * dynamic loading code \ n * html to json \ n * markdown to html to json \ n * rich text markdown parsing \ n * Custom level parsing \ n * custom style sheet \ n' + '# File function \ n' +' "// wxParse. wxml // template used for parsing "\ n' + '# Development Information \ n' +' [applet Development Forum] (http://weappdev.com) \ n' + '! [Applet logo] (http://img.php.cn/upload/article/000/001/505/115945f096a6bba61f58be0b164de67b-1.png) '; var that = this // update data that. setData ({wxParseData: WxParse ('MD', text )})}
Function List
  • Dynamic code loading

  • Convert html to json

  • Markdown to convert html to json

  • Rich text markdown analysis

  • Custom level resolution

  • Custom style sheets

TODO
  • Add more tags

  • Deduplication and custom styles

  • Solve component problems

Third-party reference
  • Html-> json html2json
    I have not found any better products yet. I feel that there is still a problem with the analysis. please provide better substitutes.

  • Markdown-> html showdown

The above is the detailed content of wxParse Alpha0.1 which supports HTML and markdown parsing in the rich text of mini programs. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.