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服务器 ...
随机推荐
- C# Where
判断一个字符串中是否包含字符串数组里的字符,恶意字符限制提交,一般人,包括最初的我,会这样写 public bool ValidateStr(string[] parms) { bool result ...
- redis单主机多实例
假设我们服务器上面已经安装好了redis: 可参看:http://zlyang.blog.51cto.com/1196234/1834700 下面我们来配置redis单主机多实例: 我们首先拷贝两份文 ...
- Js控制iphone端的input/textarea元素失去焦点时隐藏键盘
原文http://www.it165.net/pro/html/201404/12672.html function objBlur(obj, time){ if(typeof obj != 'str ...
- 解决Intellij Idea里tomcat启动报The JRE_HOME environment variable is not defined correctly的错误
创建一个maven项目后想启动tomcat测试一下新建的maven项目,结果一直报The JRE_HOME environment variable is not defined correctly, ...
- ajax加php实现简单的投票效果
废话少说,作为一个前端猿,首先上前端的代码. 1.上html代码: <!DOCTYPE html> <html> <head lang="en"> ...
- C#里面Auotpostback回刷时候,textbox里面的password怎么保存
刷新页面时,如何保留页面上的PassWord模式下的TextBox的值? this.txtUserPwd.Attributes["value"] = txtUserPwd.Text ...
- [河南省ACM省赛-第三届] 素数 (nyoj 169)
#include <iostream> #include <cstdio> #include <queue> #include <cstring> #i ...
- Zeppelin使用报错
报错信息: INFO [2016-11-03 17:05:08,481] ({pool-2-thread-2} SchedulerFactory.java[jobFinished]:137) - Jo ...
- java 格式化输出方法
在javaSE5中推出了printf方法来输出文本到控制台,在java中现在有如下方法可以输出文本: 1.System.out.println(....) //输出并换行 2.System.out.f ...
- 在eclipse中maven web项目部署到tomcat,访问不了
修改eclipse中tomcat发布路径后,能正常访问