markdown 自己搞一个浏览工具
注意!
下不能有空行
上也不能有空行 问题未解决
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="jquery.min.js"></script>
<script src="markdown.js"></script>
<link href="http://cdn.bootcss.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
<style>
code {
margin:0;
padding:1em;
background:#F9F9F9;
border:1px dashed #2F6FAB;
display:block;
white-space:pre;
font-family:"Courier New", Courier, monospace;
color:#666;
line-height:1.5;
overflow:auto;
}
</style>
</head>
<body>
<?php
session_start();
if (isset($_GET['mdpsd'])) {
if ($_GET['mdpsd'] != "xienaizhong") {
} else {
$_SESSION['loginmd'] = "1";
}
header("Location:/doc");
}
if ($_SESSION['loginmd'] != "1") {
exit("<form method='get'><input name='mdpsd'><input type='submit' value='提交'></form>");
}
?>
<textarea id="text-input" oninput="this.editor.update()"
rows="6" cols="60" style="display: none;"><?php include $_GET['f'] . ""; ?></textarea>
<div id="preview"></div>
<script>
function Editor(input, preview) {
this.update = function () {
preview.innerHTML = markdown.toHTML(input.value);
};
input.editor = this;
this.update();
}
var $ = function (id) {
return document.getElementById(id);
};
new Editor($("text-input"), $("preview"));
</script>
<hr>
<?php
$dir = __DIR__;
$file = scandir($dir);
$index = 1;
foreach ($file as $x) {
if (strpos($x, ".md") >= 1) {
echo "<a href='/doc?f=" . $x . "'>" . $x . "</a> ";
if ($index % 4 == 0) {
echo "<br>";
}
$index = $index +1;
}
}
?>
</body>
</html>
markdown 自己搞一个浏览工具的更多相关文章
- 基于 React 开发了一个 Markdown 文档站点生成工具
Create React Doc 是一个使用 React 的 markdown 文档站点生成工具.就像 create-react-app 一样,开发者可以使用 Create React Doc 来开发 ...
- 使用 history 对象和 location 对象中的属性和方法制作一个简易的网页浏览工具
查看本章节 查看作业目录 需求说明: 使用 history 对象和 location 对象中的属性和方法制作一个简易的网页浏览工具 实现思路: 使用history对象中的 forward() 方法和 ...
- Angular+Flask搭建一个记录工具
平时用的最多的文本编辑器就是Notepad++,很多东西都是通过Notepad++直接记录的: 没有看完的网页链接 要整理.收藏的网页 读书笔记 要处理的事情 待看/看过的文档和电子书 等等... 随 ...
- 【开源一个小工具】一键将网页内容推送到Kindle
最近工作上稍微闲点,这一周利用下班时间写了一个小工具,其实功能挺简单但也小折腾了会. 工具名称:Simple Send to Kindle Github地址:https://github.com/zh ...
- Xcode之外的文档浏览工具--Dash (在iOS代码库中浏览本帖)
链接地址:http://www.cocoachina.com/bbs/read.php?tid=273479 Xcode之外的文档浏览工具--Dash (在iOS代码库中浏览本帖) ...
- 7个基于Linux命令行的文件下载和网站浏览工具
7个基于Linux命令行的文件下载和网站浏览工具 时间:2015-06-01 09:36来源:linux.cn 编辑:linux.cn 点击: 2282 次 Linux命令行是GNU/Linux中最神 ...
- 推荐一个好工具:P/Invoke Interop Assistant【转】
原文地址 :http://write.blog.csdn.net/postedit 在从托管代码里面调用非托管代码的时候,经常会翻阅MSDN找到需要调用的这个程序集里面的关于需要调用方法的签名,还要特 ...
- c语言的重构、清理与代码分析图形化浏览工具: CScout
网址: https://www.spinellis.gr/cscout/ https://www2.dmst.aueb.gr/dds/cscout/index.html https://github. ...
- xdotool xdotool模拟击键和鼠标移动--CutyCapt是一个截图工具,xvfb-run
最近在做一个生成网站缩略图的功能,从网上查到相关资料,现与大家分享,xvfb这个软件,安装上之后一条命令就能执行此操作.很容易的就生成了自己想要的缩略图. xvfb-run -运行在一个虚拟的X服务器 ...
随机推荐
- Java Calendar日历类的使用
Calendar cal = Calendar.getInstance(); // 当前年 int year = cal.get(Calendar.YEAR); // 当前月 int month = ...
- PHP strtotime在linux服务器时间延迟8小时问题
今天客户反映有个功能投票模块第一天投了后,第二天就不能投了,理论上是第二天凌晨就可以再答题的,发现本地是正常的,linux服务器异常, 仔细查找原因发现是strtotime函数获取的值和本地获取的值不 ...
- python 命名规范
参考Google开源项目风格指南:https://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/cont ...
- 【小技巧】C#判断电脑是否联网
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- Framebuffer原理、使用、测试系列文章,非常好的资料,大家一起学习
转载:http://blog.csdn.net/tju355/article/details/6881372 *一.FrameBuffer的原理* FrameBuffer 是出现在 2.2.xx 内核 ...
- 一、java自带的观察者模式
Observer对象是观察者,Observable对象是被观察者. 官网api文档:http://docs.oracle.com/javase/7/docs/api/ 1. 实现观察者模式 实现观察者 ...
- python 如何读取大文件
一般的读取文件的方法: with open(file_path, "r") as f: print f.read() 或者 with open(file_path,"r& ...
- sql server 查询出的结果集,拼接某一列赋值给一个变量
现有表Area 如下: SELECT [Areaid] ,[Areaname] ,[Areapid] FROM [Northwind].[dbo].[Area] 查询结果如下图: 需求:用 “-“ ” ...
- iframe标签使用总结与注意问题
子页面访问父父页面变量,函数,页面元素 //变量: //在父页面中需定义为全局变量 //子页面中调用 var childFrameVar= parent.ParentVarName; //函数: pa ...
- IAsyncResult 接口异步 和匿名委托
IAsyncResult 接口异步 DataSet ds = new DataSet(); Mydelegate del = new Mydelegate(LoadData); IAsyncResul ...