doutidi5037 2013-11-12 17:54
浏览 40
已采纳

内容类型文字/降价不适用

I set page content type to Content-Type: text/markdown, output string should be bold but it's shown the raw string : **bold**

These are HTTP headers:

HTTP/1.1 200 OK
Cache-Control: no-cache
Connection: Keep-Alive
Content-Type: text/markdown; charset=UTF-8
Date: Tue, 12 Nov 2013 17:30:35 GMT
Keep-Alive: timeout=5, max=100
Server: Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7
Set-Cookie: laravel_session=qf3bsgt8l2ao97vh9650mq9e30; expires=Tue, 12-Nov-2013 19:30:35 GMT; path=/; httponly
Transfer-Encoding: chunked
X-Powered-By: PHP/5.4.7

I also used text/x-markdown although it's deprecated.

  • 写回答

1条回答 默认 最新

  • doulu7921 2013-11-12 18:03
    关注

    Web browsers don't understand Markdown syntax natively. You need to use a Markdown parser library to convert your markup to HTML.

    There are a whole ton to choose from. Here is a good starting point for PHP:

    http://michelf.ca/projects/php-markdown/

    From your cookie header it looks like you're using the Laravel framework? In that case you probably want to look at the ready made bundles:

    http://bundles.laravel.com/search/tag/Markdown

    If you don't want to do this server-side, you could also convert your content with javascript:

    https://github.com/evilstreak/markdown-js

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 phython读取excel表格报错 ^7个 SyntaxError: invalid syntax 语句报错
  • ¥20 @microsoft/fetch-event-source 流式响应问题
  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?