Add Spendenregister

This commit is contained in:
Dennis Reimann
2021-09-18 14:03:38 +02:00
parent 4f43d5d20a
commit e1cdb5ad86
20 changed files with 259 additions and 18 deletions

View File

@@ -4,6 +4,7 @@ const { _tr: mdTransformer } = transformer(require('jstransformer-markdown-it'))
const config = {
typographer: true,
html: true
}
// monkey-patch render function to pass custom options
@@ -22,8 +23,16 @@ const slugify = str => str.toLowerCase()
.replace(/\s+/g, '-').replace(/[^\w\-]+/g, '')
.replace(/\-\-+/g, '-').replace(/^-+/, '').replace(/-+$/, '')
const truncate = (str, wordCount) => {
const words = str.trim().split(/\s(?![^\[]*\])/g)
const head = words.splice(0, wordCount).join(' ')
const tail = words.join(' ')
return [head, tail]
}
module.exports = {
markdown: mdTransformer.render,
replacements,
slugify
slugify,
truncate
}