I often find myself using this and having to ignore template indentation. It would be great to have a floor="true" option to automatically filter the input, count minimum indentation, and then crop all indentation to set that as the floor. That way, markdown actually works.
Example:
<template>
<div>
... random html
<vue-markdown floor="true">
# Hello
- Bulletman
</vue-markdown>
</div>
</template>
The input would be filtered to:
Hello
Bulletman
instead of
__# Hello
__- Bulletman
Proposed code:
I'm sure there is a faster non regex way:
floorS (s) {
const n = s ? s.match(/\n */g).sort((a,b) => a.length > b.length).pop().length : 0
return s ? s.split('/s').map(a => a.substring(n-1)).join(\n) : s
}
Not sure if we should support tabs... /\n[ |\t]*/g should do it
I often find myself using this and having to ignore template indentation. It would be great to have a
floor="true"
option to automatically filter the input, count minimum indentation, and then crop all indentation to set that as the floor. That way, markdown actually works.Example:
The input would be filtered to:
Hello
instead of
Proposed code: I'm sure there is a faster non regex way:
Not sure if we should support tabs...
/\n[ |\t]*/g
should do it