diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-05-02 16:20:58 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-12-22 15:00:56 +0100 |
commit | 776d5a6ed80cc3ac6543d2a456a4b2333f2ede33 (patch) | |
tree | 986a20b3514495fa8e7b9cc526c33b82281cde0f /packages/gitbook-markdown/lib/toMarkdown.js | |
parent | 56b082ebb2e43b0fb1a2a7b83336222ee827d8ca (diff) | |
download | gitbook-776d5a6ed80cc3ac6543d2a456a4b2333f2ede33.zip gitbook-776d5a6ed80cc3ac6543d2a456a4b2333f2ede33.tar.gz gitbook-776d5a6ed80cc3ac6543d2a456a4b2333f2ede33.tar.bz2 |
Rename to case sensitive
Diffstat (limited to 'packages/gitbook-markdown/lib/toMarkdown.js')
-rw-r--r-- | packages/gitbook-markdown/lib/toMarkdown.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/packages/gitbook-markdown/lib/toMarkdown.js b/packages/gitbook-markdown/lib/toMarkdown.js new file mode 100644 index 0000000..aab642c --- /dev/null +++ b/packages/gitbook-markdown/lib/toMarkdown.js @@ -0,0 +1,51 @@ + +// 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 = { + 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 '-----'; + } +}; + |