23 Commits

Author SHA1 Message Date
0d6bd4fcd0 Test octokit 2020-08-12 23:15:59 +09:00
36b920fecb Add react-ace 2020-08-12 22:43:40 +09:00
c97900eff8 Scaffold react app 2020-08-10 00:08:58 +09:00
3b2197f6e1 Update description 2020-07-19 13:34:00 +09:00
25e3a1724f Merge pull request #15 from tanabe/feature/update-guide
Feature/update guide
2020-07-18 01:46:42 +09:00
06b42307c4 Update styles 2020-07-18 01:45:40 +09:00
c9fdfe06b3 Update usage 2020-07-18 01:31:22 +09:00
7aeed5644d Create LICENSE 2020-07-18 01:03:07 +09:00
793d2ac5f8 Delete images 2020-07-04 13:10:52 +09:00
a4edbbba71 Add deploy script and mofidy footer margin 2020-07-02 22:55:14 +09:00
1618c935eb Merge pull request #14 from tanabe/feature/update-favicon
Update favicon
2020-06-30 01:42:04 +09:00
e39924b172 Update favicon 2020-06-30 01:36:26 +09:00
a8860953cf update footer 2020-05-09 10:48:39 +09:00
9a09b2e9f2 Merge branch 'feature/deploy-settings' 2020-05-09 09:30:22 +09:00
93abe65c95 add firebase settings 2020-05-09 09:28:54 +09:00
82910fac42 move files 2020-05-09 09:23:35 +09:00
b6729ea71d fix adhoc 2019-02-16 23:55:44 +09:00
94a08cba79 update footer 2019-02-16 23:55:44 +09:00
1b17ff3cf4 Merge pull request #9 from jeffersonlam/master
Add strikethrough example syntax to readme
2019-01-16 00:39:15 +09:00
b82ef5dd1b Merge branch 'feature/side-by-side' 2018-10-09 23:02:52 +09:00
87c2ab9e3b Add strikethrough example syntax to readme 2015-04-15 09:38:43 -05:00
786e4a6259 fixed #8 2015-01-14 22:06:52 +09:00
3000ccbba0 implement side by side view 2015-01-13 23:12:03 +09:00
38 changed files with 11521 additions and 2512 deletions

27
.gitignore vendored Normal file
View File

@ -0,0 +1,27 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# project specific
.firebaserc
.firebase/

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Hideaki Tanabe
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,39 +1,13 @@
# hello, This is Markdown Live Preview
# Markdown Live Preview
visit [markdownlivepreview.com](http://markdownlivepreview.com)
This is the code for [Markdown Live Preview](https://markdownlivepreview.com/).
----
## what is Markdown?
see [Wikipedia](http://en.wikipedia.org/wiki/Markdown)
## Getting Started
> Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz allowing people "to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)".
### Setup
----
## usage
1. Write markdown text in this textarea.
2. Click 'HTML Preview' button.
### Build
----
## markdown quick reference
# headers
*emphasis*
**strong**
* list
>block quote
code (4 spaces indent)
[links](http://wikipedia.org)
----
## changelog
* 17-Feb-2013 re-design
* 19-May-2011 launch
----
## thanks
* [markdown-js](https://github.com/evilstreak/markdown-js)
## License
See the [LICENSE](https://github.com/tanabe/markdown-live-preview/blob/master/LICENSE) file in this repo.

View File

@ -1,290 +0,0 @@
@charset "UTF-8";
.markdown-body {
font-size: 14px;
line-height: 1.6;
overflow: hidden
}
.markdown-body>*: first-child {
margin-top: 0 !important
}
.markdown-body>*: last-child {
margin-bottom: 0 !important
}
.markdown-body a.absent {
color: #c00
}
.markdown-body a.anchor {
display: block;
padding-left: 30px;
margin-left: -30px;
cursor: pointer;
position: absolute;
top: 0;
left: 0;
bottom: 0
}
.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
cursor: text;
position: relative
}
.markdown-body h1 .mini-icon-link,.markdown-body h2 .mini-icon-link,.markdown-body h3 .mini-icon-link,.markdown-body h4 .mini-icon-link,.markdown-body h5 .mini-icon-link,.markdown-body h6 .mini-icon-link {
display: none;
color: #000
}
.markdown-body h1: hover a.anchor,.markdown-body h2: hover a.anchor,.markdown-body h3: hover a.anchor,.markdown-body h4: hover a.anchor,.markdown-body h5: hover a.anchor,.markdown-body h6: hover a.anchor {
text-decoration: none;
line-height: 1;
padding-left: 0;
margin-left: -22px;
top: 15%
}
.markdown-body h1: hover a.anchor .mini-icon-link,.markdown-body h2: hover a.anchor .mini-icon-link,.markdown-body h3: hover a.anchor .mini-icon-link,.markdown-body h4: hover a.anchor .mini-icon-link,.markdown-body h5: hover a.anchor .mini-icon-link,.markdown-body h6: hover a.anchor .mini-icon-link {
display: inline-block
}
.markdown-body h1 tt,.markdown-body h1 code,.markdown-body h2 tt,.markdown-body h2 code,.markdown-body h3 tt,.markdown-body h3 code,.markdown-body h4 tt,.markdown-body h4 code,.markdown-body h5 tt,.markdown-body h5 code,.markdown-body h6 tt,.markdown-body h6 code {
font-size: inherit
}
.markdown-body h1 {
font-size: 28px;
color: #000
}
.markdown-body h2 {
font-size: 24px;
border-bottom: 1px solid #ccc;
color: #000
}
.markdown-body h3 {
font-size: 18px
}
.markdown-body h4 {
font-size: 16px
}
.markdown-body h5 {
font-size: 14px
}
.markdown-body h6 {
color: #777;
font-size: 14px
}
.markdown-body p,.markdown-body blockquote,.markdown-body ul,.markdown-body ol,.markdown-body dl,.markdown-body table,.markdown-body pre {
margin: 15px 0
}
.markdown-body hr {
background: transparent url("https: //a248.e.akamai.net/assets.github.com/assets/primer/markdown/dirty-shade-6ead57f83b0f117a80ba77232aff0673bfd71263.png") repeat-x 0 0;
border: 0 none;
color: #ccc;
height: 4px;
padding: 0
}
.markdown-body>h2: first-child,.markdown-body>h1: first-child,.markdown-body>h1: first-child+h2,.markdown-body>h3: first-child,.markdown-body>h4: first-child,.markdown-body>h5: first-child,.markdown-body>h6: first-child {
margin-top: 0;
padding-top: 0
}
.markdown-body a: first-child h1,.markdown-body a: first-child h2,.markdown-body a: first-child h3,.markdown-body a: first-child h4,.markdown-body a: first-child h5,.markdown-body a: first-child h6 {
margin-top: 0;
padding-top: 0
}
.markdown-body h1+p,.markdown-body h2+p,.markdown-body h3+p,.markdown-body h4+p,.markdown-body h5+p,.markdown-body h6+p {
margin-top: 0
}
.markdown-body li p.first {
display: inline-block
}
.markdown-body ul,.markdown-body ol {
padding-left: 30px
}
.markdown-body ul.no-list,.markdown-body ol.no-list {
list-style-type: none;
padding: 0
}
.markdown-body ul li>: first-child,.markdown-body ul li ul: first-of-type,.markdown-body ol li>: first-child,.markdown-body ol li ul: first-of-type {
margin-top: 0px
}
.markdown-body ul ul,.markdown-body ul ol,.markdown-body ol ol,.markdown-body ol ul {
margin-bottom: 0
}
.markdown-body dl {
padding: 0
}
.markdown-body dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px
}
.markdown-body dl dt: first-child {
padding: 0
}
.markdown-body dl dt>: first-child {
margin-top: 0px
}
.markdown-body dl dt>: last-child {
margin-bottom: 0px
}
.markdown-body dl dd {
margin: 0 0 15px;
padding: 0 15px
}
.markdown-body dl dd>: first-child {
margin-top: 0px
}
.markdown-body dl dd>: last-child {
margin-bottom: 0px
}
.markdown-body blockquote {
border-left: 4px solid #DDD;
padding: 0 15px;
color: #777
}
.markdown-body blockquote>: first-child {
margin-top: 0px
}
.markdown-body blockquote>: last-child {
margin-bottom: 0px
}
.markdown-body table th {
font-weight: bold
}
.markdown-body table th,.markdown-body table td {
border: 1px solid #ccc;
padding: 6px 13px
}
.markdown-body table tr {
border-top: 1px solid #ccc;
background-color: #fff
}
.markdown-body table tr: nth-child(2n) {
background-color: #f8f8f8
}
.markdown-body img {
max-width: 100%;
-moz-box-sizing: border-box;
box-sizing: border-box
}
.markdown-body span.frame {
display: block;
overflow: hidden
}
.markdown-body span.frame>span {
border: 1px solid #ddd;
display: block;
float: left;
overflow: hidden;
margin: 13px 0 0;
padding: 7px;
width: auto
}
.markdown-body span.frame span img {
display: block;
float: left
}
.markdown-body span.frame span span {
clear: both;
color: #333;
display: block;
padding: 5px 0 0
}
.markdown-body span.align-center {
display: block;
overflow: hidden;
clear: both
}
.markdown-body span.align-center>span {
display: block;
overflow: hidden;
margin: 13px auto 0;
text-align: center
}
.markdown-body span.align-center span img {
margin: 0 auto;
text-align: center
}
.markdown-body span.align-right {
display: block;
overflow: hidden;
clear: both
}
.markdown-body span.align-right>span {
display: block;
overflow: hidden;
margin: 13px 0 0;
text-align: right
}
.markdown-body span.align-right span img {
margin: 0;
text-align: right
}
.markdown-body span.float-left {
display: block;
margin-right: 13px;
overflow: hidden;
float: left
}
.markdown-body span.float-left span {
margin: 13px 0 0
}
.markdown-body span.float-right {
display: block;
margin-left: 13px;
overflow: hidden;
float: right
}
.markdown-body span.float-right>span {
display: block;
overflow: hidden;
margin: 13px auto 0;
text-align: right
}
.markdown-body code,.markdown-body tt {
margin: 0 2px;
padding: 0px 5px;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px
}
.markdown-body code {
white-space: nowrap
}
.markdown-body pre>code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent
}
.markdown-body .highlight pre,.markdown-body pre {
background-color: #f8f8f8;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px
}
.markdown-body pre code,.markdown-body pre tt {
margin: 0;
padding: 0;
background-color: transparent;
border: none
}
.markdown-body a {
color: #4183c4;
text-decoration: none;
}
.markdown-body a:hover {
text-decoration: underline;
}
.markdown-body pre,
.markdown-body code {
font-size: 12px;
font-family: Consolas, "Liberation Mono", Courier, monospace;
}

View File

@ -1,328 +0,0 @@
html, body {
position: relative;
color: #333;
overflow-x: hidden;
margin: 0;
padding: 0;
font-family: Helvetica, arial, freesans, clean, sans-serif;
font-size: 1em;
line-height: 1.5em;
background-color: #444;
}
h1, h2, h3, h4, h5, h6, p {
font-size: 1em;
margin: 0;
padding: 0;
font-weight: normal;
}
p {
margin: 1em;
}
a:link,
a:visited,
a:hover
a:active {
color: #333;
text-decoration: none;
}
img {
border: none;
}
#header {
padding: 10px 0 ;
background-color: #444;
width: 100%;
text-align: center;
}
#header h1 {
color: #fff;
padding-bottom: 10px;
}
ul#menu {
margin: 0;
padding: 0;
list-style: none;
}
ul#menu li {
color: #999;
margin: 0;
margin-right: 5px;
padding: 10px;
list-style: none;
display: inline-block;
border-radius: 10px;
}
ul#menu a.edit li {
padding-left: 35px;
background: transparent url(../image/icon_edit_off.png) no-repeat 10px center;
}
ul#menu a.edit.active li {
background: transparent url(../image/icon_edit.png) no-repeat 10px center;
}
ul#menu a.preview li {
padding-left: 40px;
background: transparent url(../image/icon_preview_off.png) no-repeat 10px center;
}
ul#menu a.preview.active li {
background: transparent url(../image/icon_preview.png) no-repeat 10px center;
}
ul#menu li:hover {
/* text-decoration: underline;*/
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0, 0.4), rgba(255,255,255,0.1) 0 1px 0;
box-shadow: inset 0 0 5px rgba(0,0,0, 0.4), rgba(255,255,255,0.1) 0 1px 0;
border-radius: 4px;
}
ul#menu a.active li {
color: #fff;
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0, 0.4), rgba(255,255,255,0.1) 0 1px 0;
box-shadow: inset 0 0 5px rgba(0,0,0, 0.4), rgba(255,255,255,0.1) 0 1px 0;
border-radius: 4px;
}
#container {
min-height: 100%;
height: auto !important;
height: 100%;
width: 960px;
padding: 20px;
margin: 0 auto;
background-color: #fff;
border-radius: 10px;
}
#container .section {
margin-bottom: 20px;
}
#content .mode {
border: 1px solid #ddd;
border-radius: 3px;
}
#content .mode ul.submenu {
list-style: none;
margin: 0;
padding: 5px;
border-bottom: 1px solid #ddd;
background-color: #eee;
}
#content .mode ul.submenu li {
display: inline-block;
font-size: 12px;
font-weight: bold;
border-radius: 3px;
padding: 0 5px;
border: 1px solid #ddd;
background-color: #f3f3f3;
}
#content .mode ul.submenu li:hover {
text-decoration: underline;
}
#content .mode .content {
padding: 10px;
}
#preview {
display: none;
}
.section h2 {
color: #466964;
font-weight: bold;
font-size: 1.5em;
margin-bottom: 10px;
}
#leftColumn {
float: left;
width: 700px;
}
#rightColumn {
width: 240px;
float: right;
}
textarea#markdown {
padding: 0;
margin: 0;
width: 100%;
height: 400px;
overflow: auto;
font-size: 15px;
border: none;
/* border: 2px solid #D1D1BC;*/
resize: vertical;
outline: none;
}
/*
#output {
background-color: #f8f8f8;
border: 2px solid #A7C4BB;
min-height: 100px;
padding: 10px;
}
#output p {
line-height: 1.3em;
}
#output h1,
#output h2,
#output h3,
#output h4,
#output h5,
#output h6 {
font-weight: bold;
color: #000;
}
#output h1 {
font-size: 1.7em;
}
#output h2 {
font-size: 1.5em;
}
#output h3 {
font-size: 1em;
}
#output ol,
#output ul {
margin: 0;
}
#output blockquote,
#output pre {
margin: 0;
padding: 5px;
color: #g;
background-color: #eee;
border: 1px solid #ddd;
line-height: 1.5em;
}
#output code {
margin: 0;
padding: 0;
line-height: 1em;
}
*/
table#reference {
width: 238px;
border: 1px #ddd solid;
border-collapse: collapse;
border-spacing: 0;
}
table#reference th {
border: #ddd solid;
border-width: 0 0 1px 1px;
background-color: #eee;
font-weight: bold;
line-height: 120%;
text-align: center;
padding: 5px;
}
table#reference td {
border: 1px #ddd solid;
border-width: 0 0 1px 1px;
text-align: center;
padding: 5px;
}
#reference p {
margin: 0;
padding: 0;
}
#reference ul,
#reference ol,
#reference blockquote {
margin: 0;
padding: 0;
padding-left: 0;
list-style-position: inside;
}
#reference ul li,
#reference ol li {
padding-left: 0;
}
#reference h1,
#reference h2,
#reference h3,
#reference h4,
#reference h5,
#reference h6 {
font-weight: bold;
color: #000;
}
#footer {
clear: both;
width: 100%;
height: 50px;
padding: 10px;
margin-bottom: 30px;
background-color: #444;
color: #fff;
text-align: center;
}
#footer #copyright {
font-size: 12px;
color: #999;
}
#footer #copyright a {
font-size: 12px;
color: #999;
}
#footer #copyright a:hover {
color: #fff;
text-decoration: underline;
}
ul#shareLinks,
ul#shareLinks li {
margin: 0;
padding: 0;
list-style: none;
}
ul#shareLinks li {
display: inline-block;
vertical-align: middle;
}
ul#shareLinks li.facebook {
margin-top: 10px;
}

3
deploy.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
firebase deploy

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

10
firebase.json Normal file
View File

@ -0,0 +1,10 @@
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}

1
github-markdown-css Submodule

Submodule github-markdown-css added at 1485dd78f5

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -1,88 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-language" content="en">
<meta http-equiv="content-script-type" content="text/javascript">
<meta http-equiv="content-style-type" content="text/css">
<meta name="description" content="This is the Markdown editor with live preview. enjoy.">
<meta name="keywords" content="markdown,editor,github,live,preview,tutorial">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/github.css">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="js/jquery.autosize-min.js"></script>
<script type="text/javascript" src="js/markdown.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<title>Markdown Live Preview</title>
</head>
<body>
<div id="header">
<h1><a href="./"><img src="image/logo.png" width="306" height="20" alt="Markdown Live Preview"></a></h1>
<ul id="menu">
<a href="javascript:void(null);" data-menu-id="edit" class="edit active"><li>Edit Markdown</li></a>
<a href="javascript:void(null);" class="preview" data-menu-id="preview"><li>HTML Preview</li></a>
</ul>
</div>
<div id="container">
<div id="content" class="section">
<div id="edit" class="mode">
<ul class="submenu">
<a href="javascript:void(null);" id="clearButton"><li>clear</li></a>
</ul>
<div class="content">
<textarea id="markdown">
</textarea>
</div>
</div>
<div id="preview" class="mode">
<div id="output" class="content markdown-body">
</div>
</div>
</div>
</div>
<div id="footer">
<ul id="shareLinks">
<li class="google">
<!-- Place this tag where you want the share button to render. -->
<div class="g-plus" data-action="share"></div>
<!-- Place this tag after the last share tag. -->
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
</li>
<li class="twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-url="http://markdownlivepreview.com" data-via="tanabe">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></li>
<li class="facebook"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmarkdownlivepreview.com&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;font=tahoma&amp;colorscheme=dark&amp;action=like&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe></li>
</ul>
<div id="copyright">Copyright 2013 <a href="https://twitter.com/tanabe">tanabe</a>.</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-73660-14']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +0,0 @@
/*
jQuery Autosize v1.16.5
(c) 2013 Jack Moore - jacklmoore.com
updated: 2013-02-11
license: http://www.opensource.org/licenses/mit-license.php
*/
(function(e){var t,o={className:"autosizejs",append:"",callback:!1},i="hidden",n="border-box",s="lineHeight",a='<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden;"/>',r=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],l="oninput",c="onpropertychange",h=e(a).data("autosize",!0)[0];h.style.lineHeight="99px","99px"===e(h).css(s)&&r.push(s),h.style.lineHeight="",e.fn.autosize=function(s){return s=e.extend({},o,s||{}),h.parentNode!==document.body&&e(document.body).append(h),this.each(function(){function o(){t=b,h.className=s.className,e.each(r,function(e,t){h.style[t]=f.css(t)})}function a(){var e,n,a;if(t!==b&&o(),!d){d=!0,h.value=b.value+s.append,h.style.overflowY=b.style.overflowY,a=parseInt(b.style.height,10),h.style.width=Math.max(f.width(),0)+"px",h.scrollTop=0,h.scrollTop=9e4,e=h.scrollTop;var r=parseInt(f.css("maxHeight"),10);r=r&&r>0?r:9e4,e>r?(e=r,n="scroll"):p>e&&(e=p),e+=g,b.style.overflowY=n||i,a!==e&&(b.style.height=e+"px",x&&s.callback.call(b)),setTimeout(function(){d=!1},1)}}var p,d,u,b=this,f=e(b),g=0,x=e.isFunction(s.callback);f.data("autosize")||((f.css("box-sizing")===n||f.css("-moz-box-sizing")===n||f.css("-webkit-box-sizing")===n)&&(g=f.outerHeight()-f.height()),p=Math.max(parseInt(f.css("minHeight"),10)-g,f.height()),u="none"===f.css("resize")||"vertical"===f.css("resize")?"none":"horizontal",f.css({overflow:i,overflowY:i,wordWrap:"break-word",resize:u}).data("autosize",!0),c in b?l in b?b[l]=b.onkeyup=a:b[c]=a:b[l]=a,e(window).resize(function(){d=!1,a()}),f.bind("autosize",function(){d=!1,a()}),a())})}})(window.jQuery||window.Zepto);

View File

@ -1,127 +0,0 @@
var example = [
"# hello, This is Markdown Live Preview",
"",
"----",
"## what is Markdown?",
"see [Wikipedia](http://en.wikipedia.org/wiki/Markdown)",
"",
"> Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz allowing people \"to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)\".",
"",
"----",
"## usage",
"1. Write markdown text in this textarea.",
"2. Click 'HTML Preview' button.",
"",
"----",
"## markdown quick reference",
"# headers",
"",
"*emphasis*",
"",
"**strong**",
"",
"* list",
"",
">block quote",
"",
" code (4 spaces indent)",
"[links](http://wikipedia.org)",
"",
"----",
"## changelog",
"* 17-Feb-2013 re-design",
"",
"----",
"## thanks",
"* [markdown-js](https://github.com/evilstreak/markdown-js)",
""
].join("\n");
$(function() {
var currentMode = 'edit';
var container = $('#container');
var header = $('#header');
var headerHeight = header.outerHeight();
var titleHeight = $('#header h1').outerHeight();
var fixedTop = -titleHeight;
var scrollTops = {
'edit' : 0,
'preview' : 0
};
var isEdited = false;
$(window).scroll(function() {
var scrollTop = $(window).scrollTop();
scrollTops[currentMode] = scrollTop;
if ((scrollTop > titleHeight)) {
header.css({
'position' : 'fixed',
'top' : fixedTop + 'px',
'z-index' : '100'
});
container.css({
'margin-top' : headerHeight + 'px'
});
} else {
header.css('position', 'static');
container.css({
'margin-top' : 0
});
}
});
$('#markdown').val(example);
$('#output').html(markdown.toHTML(example));
$('#markdown').bind('keyup', function() {
isEdited = true;
$('#output').html(markdown.toHTML($('#markdown').val()));
});
//menu
var menuItems = $('#menu a');
menuItems.click(function(event) {
event.preventDefault();
menuItems.removeClass('active');
var sender = $(event.currentTarget);
sender.addClass('active');
$('#content .mode').hide();
var menuId = sender.data('menuId');
currentMode = menuId;
$('#' + menuId).show();
$(window).scrollTop(scrollTops[currentMode]);
});
//reference
$("table#reference tr td:odd").each(function(index, element) {
var self = $(element);
if (self.html() === "") {
self.html(markdown.toHTML(self.siblings().html()));
}
});
//clear
$('#clearButton').click(function(event) {
event.preventDefault();
if (window.confirm('Are you sure you want to delete?')) {
$('#markdown').val('');
}
});
//autoresize
$('textarea').autosize();
//$('#markdown').focus();
//leave
$(window).bind('beforeunload', function() {
if (isEdited) {
return 'Are you sure you want to leave? Your changes will be lost.';
}
});
});

File diff suppressed because it is too large Load Diff

6
local-server.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
SCRIPT_DIR=$(cd $(dirname $0); pwd)
pushd ./build
python -m http.server 8000
popd

37
package.json Normal file
View File

@ -0,0 +1,37 @@
{
"name": "markdown-live-preview",
"version": "2.0.0",
"private": true,
"dependencies": {
"@octokit/rest": "^18.0.3",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"ace-builds": "^1.4.12",
"react": "^16.13.1",
"react-ace": "^9.1.2",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

33
public/404.html Normal file
View File

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Page Not Found</title>
<style media="screen">
body { background: #ECEFF1; color: rgba(0,0,0,0.87); font-family: Roboto, Helvetica, Arial, sans-serif; margin: 0; padding: 0; }
#message { background: white; max-width: 360px; margin: 100px auto 16px; padding: 32px 24px 16px; border-radius: 3px; }
#message h3 { color: #888; font-weight: normal; font-size: 16px; margin: 16px 0 12px; }
#message h2 { color: #ffa100; font-weight: bold; font-size: 16px; margin: 0 0 8px; }
#message h1 { font-size: 22px; font-weight: 300; color: rgba(0,0,0,0.6); margin: 0 0 16px;}
#message p { line-height: 140%; margin: 16px 0 24px; font-size: 14px; }
#message a { display: block; text-align: center; background: #039be5; text-transform: uppercase; text-decoration: none; color: white; padding: 16px; border-radius: 4px; }
#message, #message a { box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); }
#load { color: rgba(0,0,0,0.4); text-align: center; font-size: 13px; }
@media (max-width: 600px) {
body, #message { margin-top: 0; background: white; box-shadow: none; }
body { border-top: 16px solid #ffa100; }
}
</style>
</head>
<body>
<div id="message">
<h2>404</h2>
<h1>Page Not Found</h1>
<p>The specified file was not found on this website. Please check the URL for mistakes and try again.</p>
<h3>Why am I seeing this?</h3>
<p>This page was generated by the Firebase Command-Line Interface. To modify it, edit the <code>404.html</code> file in your project's configured <code>public</code> directory.</p>
</div>
</body>
</html>

BIN
public/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

43
public/index.html Normal file
View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>

BIN
public/logo192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
public/logo512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

25
public/manifest.json Normal file
View File

@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

3
public/robots.txt Normal file
View File

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

38
src/App.css Normal file
View File

@ -0,0 +1,38 @@
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

26
src/App.js Normal file
View File

@ -0,0 +1,26 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export default App;

9
src/App.test.js Normal file
View File

@ -0,0 +1,9 @@
import React from 'react';
import { render } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

13
src/index.css Normal file
View File

@ -0,0 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

30
src/index.js Normal file
View File

@ -0,0 +1,30 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import AceEditor from "react-ace";
import "ace-builds/src-noconflict/mode-java";
import "ace-builds/src-noconflict/theme-github";
//const { Octokit } = require("@octokit/rest");
//const octokit = new Octokit();
function onChange(newValue) {
// console.log("change", newValue);
}
ReactDOM.render(
<AceEditor
mode="java"
theme="github"
onChange={onChange}
name="UNIQUE_ID_OF_DIV"
editorProps={{ $blockScrolling: true }}
/>,
document.getElementById('root')
);
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();

7
src/logo.svg Normal file
View File

@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">
<g fill="#61DAFB">
<path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>
<circle cx="420.9" cy="296.5" r="45.7"/>
<path d="M520.5 78.1z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

141
src/serviceWorker.js Normal file
View File

@ -0,0 +1,141 @@
// This optional code is used to register a service worker.
// register() is not called by default.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.
// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.0/8 are considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);
export function register(config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
return;
}
window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not.
checkValidServiceWorker(swUrl, config);
// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://bit.ly/CRA-PWA'
);
});
} else {
// Is not localhost. Just register service worker
registerValidSW(swUrl, config);
}
});
}
}
function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker == null) {
return;
}
installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) {
// At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older
// content until all client tabs are closed.
console.log(
'New content is available and will be used when all ' +
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
);
// Execute callback
if (config && config.onUpdate) {
config.onUpdate(registration);
}
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
console.log('Content is cached for offline use.');
// Execute callback
if (config && config.onSuccess) {
config.onSuccess(registration);
}
}
}
};
};
})
.catch(error => {
console.error('Error during service worker registration:', error);
});
}
function checkValidServiceWorker(swUrl, config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl, {
headers: { 'Service-Worker': 'script' },
})
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type');
if (
response.status === 404 ||
(contentType != null && contentType.indexOf('javascript') === -1)
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
window.location.reload();
});
});
} else {
// Service worker found. Proceed as normal.
registerValidSW(swUrl, config);
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
);
});
}
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready
.then(registration => {
registration.unregister();
})
.catch(error => {
console.error(error.message);
});
}
}

5
src/setupTests.js Normal file
View File

@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom/extend-expect';

11036
yarn.lock Normal file

File diff suppressed because it is too large Load Diff