du656637962 2016-05-18 09:48
浏览 82
已采纳

html视觉编辑,如php中的whatsapp

recent version of whatsapp introduced little bit of styling the message, suppose we want to write something like this

input This is a ~statement~ which has styling in it

output This is a statement which has styling in it

even stackoverflow has this kind of minimal styling which gives great look, we want to implement this in our platform where teachers while giving remark to student can give ol, ul, bold, italic but we also want to make sure they are not allowed to use traditional html tags because when tag changes we have to make changes instead we like the approach where you can add special character with word and turn them way you want in the output.

I don't know what is the specific terms for this type of editing so please ignore it.

language since our platform is already running in php we would like to implement that in php

thought process we thought it might be possible with regex but don't know how to implement ol, ul and we are not very sure if that is a correct method to implement

why not allowing traditional html tags

  1. Not all of them know traditional html tags
  2. want to keep our application secure
  • 写回答

2条回答 默认 最新

  • dpaal28266 2016-05-18 09:59
    关注

    Take a look at this GitHub library

    Here are some examples:

    // traditional markdown and parse full text
    $parser = new \cebe\markdown\Markdown();
    $parser->parse($markdown);
    
    // use github markdown
    $parser = new \cebe\markdown\GithubMarkdown();
    $parser->parse($markdown);
    
    // use markdown extra
    $parser = new \cebe\markdown\MarkdownExtra();
    $parser->parse($markdown);
    
    // parse only inline elements (useful for one-line descriptions)
    $parser = new \cebe\markdown\GithubMarkdown();
    $parser->parseParagraph($markdown);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效