markdown内容在网页上显示

发布时间:2022-01-25 21:36:14

项目需要考虑到推广就需要开始写博文了,首先在后台加了个markdown 但是是显示开始没有找到合适的控件

后面找到下面这个插件

官网地址:https://strapdownjs.com/

官方示例引用的地址是:

<script src="http://strapdownjs.com/v/0.2/strapdown.js"></script>

但是这个在服务器上是访问不到的,原因you know

所以我们需要将这个js下载下来,同时需要下载js中引用的css

http://strapdownjs.com/v/0.2/strapdown.css
http://strapdownjs.com/v/0.2/themes/bootstrap-responsive.min.css
http://strapdownjs.com/v/0.2/themes/united.min.css  默认样式

在样式下载下来后,位置发生了变化需要引用代码,在js中373的位置

// Stylesheets
  var linkEl = document.createElement('link');
  linkEl.href = '/js/themes/'+theme+'.min.css';
  linkEl.rel = 'stylesheet';
  document.head.appendChild(linkEl);

  var linkEl = document.createElement('link');
  linkEl.href = '/js/strapdown.css';
  linkEl.rel = 'stylesheet';
  document.head.appendChild(linkEl);

  var linkEl = document.createElement('link');
  linkEl.href = '/js/themes/bootstrap-responsive.min.css';
  linkEl.rel = 'stylesheet';
  document.head.appendChild(linkEl);

最后在united.min.css中第一行就引用了google的内容 也需要注释

/**
 * @import url(https://fonts.googleapis.com/css?family=Ubuntu);
 * */

Card image cap
APP STORE
Card image cap
应用宝
Card image cap
小米
Card image cap
华为