summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-markdown/lib/toMarkdown.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-12-22 15:51:59 +0100
committerSamy Pessé <samypesse@gmail.com>2016-12-22 15:51:59 +0100
commitc4e512477e3cbe1344caaa2f1cc56e4bb402ad79 (patch)
treeca43a054bf84a49b48c942b754153b5459eed3ee /packages/gitbook-markdown/lib/toMarkdown.js
parent6e0fd5d5d44fc2c97e075c4bbff188a0a7e797c1 (diff)
downloadgitbook-c4e512477e3cbe1344caaa2f1cc56e4bb402ad79.zip
gitbook-c4e512477e3cbe1344caaa2f1cc56e4bb402ad79.tar.gz
gitbook-c4e512477e3cbe1344caaa2f1cc56e4bb402ad79.tar.bz2
Import gitbook-markdown
Diffstat (limited to 'packages/gitbook-markdown/lib/toMarkdown.js')
-rw-r--r--packages/gitbook-markdown/lib/toMarkdown.js56
1 files changed, 0 insertions, 56 deletions
diff --git a/packages/gitbook-markdown/lib/toMarkdown.js b/packages/gitbook-markdown/lib/toMarkdown.js
deleted file mode 100644
index 71de016..0000000
--- a/packages/gitbook-markdown/lib/toMarkdown.js
+++ /dev/null
@@ -1,56 +0,0 @@
-var escape = require('markdown-escape');
-
-// Return N time a string
-function ns(s, n) {
- return Array(n + 1).join(s);
-}
-
-/*
- * This module provides markup rules for gitbook-html
- * These rules are being used to generate SUMMARY/GLOSSARY/LANGS
- */
-module.exports = {
- onText: function(text) {
- return escape(text);
- },
-
- onTitleStart: function(level) {
- return ns('#', level) + ' ';
- },
- onTitleEnd: function(level) {
- return this.onBL();
- },
-
- onParagraphStart: function() {
- return this.onSection();
- },
- onParagraphEnd: function() {
- return this.onSection();
- },
-
- onLinkStart: function() {
- return '[';
- },
- onLinkEnd: function(href) {
- return '](' + href +')';
- },
-
- onListStart: function(level) {
- return '';
- },
- onListEnd: function() {
- return '';
- },
-
- onListItemStart: function(level) {
- return ns(' ', level * 4) + '* ';
- },
- onListItemEnd: function() {
- return '';
- },
-
- onHR: function() {
- return '-----';
- }
-};
-