-
Notifications
You must be signed in to change notification settings - Fork 0
/
readme.html
160 lines (117 loc) · 2.88 KB
/
readme.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Open Index or Markdown</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=contain">
<meta name="description"
content="File wrangler. Default index.html file. Opens HTML or Markdown files. Passes location.hash.">
<meta name="keywords" content="ShowDown,Markdown,AJAX,JavaScript,HTML,CSS,GitHub,FOSS">
<meta name="version" content="2022-10-07">
<style>
/* Copyright 2022 Theo Armour. MIT License */
:root {
font: 100% monospace;
--color: darkred;
--color-light: crimson;
}
* {
box-sizing: border-box;
}
body {
margin: 0 auto;
max-width: 50rem;
}
h1,
h2,
h3 {
color: var(--color);
}
a {
color: var(--color-light);
text-decoration: none;
}
a:hover,
a:focus,
a:active {
text-decoration: underline;
}
aside {
border: 1px solid lightgray;
margin-top: 15px;
padding: 2px;
}
button,
input[type=button] {
background-color: #eee;
border: 2px #eee solid;
color: #888;
}
blockquote {
background-color: #ddd;
padding: 1rem;
}
code {
background-color: #eee;
}
pre {
background-color: #eee;
padding: 0.5rem;
}
summary {
cursor: pointer;
font-size: 2.5rem;
font-weight: bold;
outline: none;
}
::-webkit-scrollbar {
background: #ddd;
}
::-webkit-scrollbar-thumb {
background: var(--color);
}
.aDingbat {
text-decoration: none;
font-size: 2rem;
}
.iframe-resize {
height: 400px;
overflow: hidden;
padding: 0.5rem;
resize: both;
width: 100%;
}
</style>
</head>
<body>
<!-- https://github.com/showdownjs/showdown -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/2.1.0/showdown.min.js"></script>
<div id=divContent></div>
<script>
defaultFile = "README.md";
//location.hash = "../assets/markdown-help.md"; // test
//location.hash = "../style/style-sample-tags.html"
init();
function init () {
showdown.setFlavor( "github" );
if ( !location.hash ) { location.hash = defaultFile; }
location.hash.endsWith( ".md" ) ? onHashChange() : window.location.href = location.hash.slice( 1 );
window.addEventListener( "hashchange", onHashChange, false );
}
function onHashChange () {
const url = location.hash.slice( 1 );
document.title = url.split( "/" ).pop();
const options = { openLinksInNewWindow: false, excludeTrailingPunctuationFromURLs: true, ghMention: true, simplifiedAutoLink: true, simpleLineBreaks: true, emoji: true };
const xhr = new XMLHttpRequest();
xhr.open( "get", url, true );
xhr.onload = () => {
let txt = xhr.responseText;
txt = txt.replace( /\<!--@@@/, "" ).replace( /\@@@-->/, "" );
divContent.innerHTML = new showdown.Converter( options ).makeHtml( txt );
window.scrollTo( 0, 0 );
};
xhr.send( null );
}
</script>
</body>
</html>