diff --git a/.eslintignore b/.eslintignore index 2ee8d41..bf6788c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,5 @@ coverage/ -demo/sample.js -demo-web/ +demo/ dist/ node_modules +support/demo_template/sample.js diff --git a/.gitignore b/.gitignore index 4c444c6..c6f6fff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ coverage/ +demo/ *.log diff --git a/Makefile b/Makefile index 1546f32..fd894dd 100644 --- a/Makefile +++ b/Makefile @@ -12,26 +12,30 @@ CURR_HEAD := $(firstword $(shell git show-ref --hash HEAD | cut -b -6) master) GITHUB_PROJ := https://github.com//markdown-it/${NPM_PACKAGE} -demo: lint - ./support/demodata.js > demo/sample.json - jade demo/index.jade -P --obj demo/sample.json - stylus -u autoprefixer-stylus demo/assets/index.styl - rm -rf demo/sample.json - -gh-pages: browserify demo - rm -rf ./demo-web - cp -r ./demo ./demo-web - cp ./dist/markdown-it.js ./demo-web - sed -i "s|../dist|.|" ./demo-web/index.html - cp ./support/demo_readme.md ./demo-web/README.md - touch ./demo-web/.nojekyll - cd ./demo-web \ +demo: lint browserify + rm -rf ./demo + mkdir ./demo + ./support/demodata.js > ./support/demo_template/sample.json + jade ./support/demo_template/index.jade --pretty \ + --obj ./support/demo_template/sample.json \ + --out ./demo + stylus -u autoprefixer-stylus \ + < ./support/demo_template/index.styl \ + > ./demo/index.css + rm -rf ./support/demo_template/sample.json + cp ./dist/markdown-it.js ./demo/ + cp ./support/demo_template/index.js ./demo/ + cp ./support/demo_template/README.md ./demo/ + +gh-pages: demo + touch ./demo/.nojekyll + cd ./demo \ && git init . \ && git add . \ && git commit -m "Auto-generate demo" \ && git remote add origin git@github.com:markdown-it/markdown-it.github.io.git \ && git push --force origin master - rm -rf ./demo-web + rm -rf ./demo lint: eslint --reset . diff --git a/demo/assets/index.css b/demo/assets/index.css deleted file mode 100644 index 4ef78cc..0000000 --- a/demo/assets/index.css +++ /dev/null @@ -1,145 +0,0 @@ -html, -body, -.full-height { - height: 100%; -} -body { - overflow-x: hidden; - padding-bottom: 180px; - background-color: #fbfbfb; -} -.demo-options { - margin-bottom: 10px; -} -.opt__strict .not-strict { - opacity: 0.3; -} -.checkbox { - margin-right: 10px; -} -.source { - width: 100%; - font-family: Menlo, Monaco, Consolas, "Courier New", monospace; - font-size: 13px; - padding: 2px; -} -.result-html { - padding: 2px 10px; - overflow: auto; - background-color: #fff; - border: 1px solid #ccc; - border-radius: 4px; -} -.result-html img { - max-width: 35%; -} -.result-src, -.result-debug { - display: none; - background-color: #fff; -} -.result-src-content, -.result-debug-content { - white-space: pre; -} -.result-as-html .result-html { - display: block; -} -.result-as-html .result-src, -.result-as-html .result-debug { - display: none; -} -.result-as-src .result-src { - display: block; -} -.result-as-src .result-html, -.result-as-src .result-debug { - display: none; -} -.result-as-debug .result-debug { - display: block; -} -.result-as-debug .result-html, -.result-as-debug .result-src { - display: none; -} -.demo-control { - position: absolute; - right: 40px; - top: 0; - border-radius: 0 0 6px 6px; - font-size: 12px; - background-color: #666; - color: #fff !important; - opacity: 0.6; - -webkit-transition: opacity 0.5s ease-in-out; - transition: opacity 0.5s ease-in-out; -} -.demo-control:hover { - opacity: 1; -} -.demo-control a { - padding: 0 20px; - color: #fff !important; -} -.demo-control a:first-child { - padding-left: 30px; -} -.demo-control a:last-child { - padding-right: 30px; -} -.hljs { - background: none; - padding: 0; -} -.footnotes { - -moz-column-count: 2; - -webkit-column-count: 2; - column-count: 2; -} -.footnotes-list { - padding-left: 2em; -} -.gh-ribbon { - display: block; - position: absolute; - right: -60px; - top: 44px; - -webkit-transform: rotate(45deg); - -ms-transform: rotate(45deg); - transform: rotate(45deg); - width: 230px; - z-index: 10000; - white-space: nowrap; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - background-color: #686868; - box-shadow: 0 0 2px rgba(102,102,102,0.4); - padding: 1px 0; -} -.gh-ribbon a { - text-decoration: none !important; - border: 1px solid #ccc; - color: #fff; - display: block; - font-size: 13px; - font-weight: 700; - outline: medium none; - padding: 4px 50px 2px; - text-align: center; -} -.form-inline .radio, -.form-inline .checkbox { - display: inline-block; - margin-bottom: 0; - margin-top: 0; -} -.form-inline .form-group { - display: inline-block; - margin-bottom: 0; - vertical-align: middle; -} -.form-inline .form-control { - display: inline-block; - vertical-align: middle; - width: auto; -} diff --git a/demo/index.html b/demo/index.html deleted file mode 100644 index 0ffa71b..0000000 --- a/demo/index.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - markdown-it demo - - - - - - - - - - - - - - - - - - -
-

- markdown-it - demo -

-

code sample

-
var hljs       = require('highlight.js') // https://highlightjs.org/
-
-var md = require('markdown-it')('full', {
-  html:         false,        // Enable HTML tags in source
-  xhtmlOut:     false,        // Use '/' to close single tags (<br />)
-  breaks:       false,        // Convert '\n' in paragraphs into <br>
-  langPrefix:   'language-',  // CSS language prefix for fenced blocks
-  linkify:      true,         // autoconvert URL-like texts to links
-
-  // Enable some language-neutral replacements + quotes beautification
-  typographer:  false,
-
-  // Double + single quotes replacement pairs, when typographer enabled,
-  // and smartquotes on. Set doubles to '«»' for Russian, '„“' for German.
-  quotes: '“”‘’',
-
-  // Highlighter function. Should return escaped HTML,
-  // or '' if input not changed
-  highlight: function (str, lang) {
-    if (lang && hljs.getLanguage(lang)) {
-      try {
-        return hljs.highlight(lang, str).value;
-      } catch (__) {}
-    }
-
-    try {
-      return hljs.highlightAuto(str).value;
-    } catch (__) {}
-
-    return ''; // use external default escaping
-  }
-});
-
-console.log(md.render('# markdown-it rulezz!'));
-// => <h1>markdown-it rulezz!</h1>
-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
- - -
-
- -
-
-
-
-
-
-
Fork me on GitHub
- - \ No newline at end of file diff --git a/demo/sample.js b/demo/sample.js deleted file mode 100644 index 04dc14f..0000000 --- a/demo/sample.js +++ /dev/null @@ -1,35 +0,0 @@ -var hljs = require('highlight.js') // https://highlightjs.org/ - -var md = require('markdown-it')('full', { - html: false, // Enable HTML tags in source - xhtmlOut: false, // Use '/' to close single tags (
) - breaks: false, // Convert '\n' in paragraphs into
- langPrefix: 'language-', // CSS language prefix for fenced blocks - linkify: true, // autoconvert URL-like texts to links - - // Enable some language-neutral replacements + quotes beautification - typographer: false, - - // Double + single quotes replacement pairs, when typographer enabled, - // and smartquotes on. Set doubles to '«»' for Russian, '„“' for German. - quotes: '“”‘’', - - // Highlighter function. Should return escaped HTML, - // or '' if input not changed - highlight: function (str, lang) { - if (lang && hljs.getLanguage(lang)) { - try { - return hljs.highlight(lang, str).value; - } catch (__) {} - } - - try { - return hljs.highlightAuto(str).value; - } catch (__) {} - - return ''; // use external default escaping - } -}); - -console.log(md.render('# markdown-it rulezz!')); -// =>

markdown-it rulezz!

diff --git a/support/demo_readme.md b/support/demo_template/README.md similarity index 100% rename from support/demo_readme.md rename to support/demo_template/README.md diff --git a/demo/index.jade b/support/demo_template/index.jade similarity index 93% rename from demo/index.jade rename to support/demo_template/index.jade index 072d051..ab94d2f 100644 --- a/demo/index.jade +++ b/support/demo_template/index.jade @@ -17,10 +17,10 @@ html script(src='https://cdn.jsdelivr.net/highlight.js/8.4.0/highlight.min.js') link(rel='stylesheet' href='https://cdn.jsdelivr.net/highlight.js/8.4.0/styles/solarized_light.min.css') - script(src='../dist/markdown-it.js') + script(src='markdown-it.js') - link(rel='stylesheet' href='./assets/index.css') - script(src='./assets/index.js') + link(rel='stylesheet' href='index.css') + script(src='index.js') // Ancient IE support - load shiv & kill broken highlighter