diff options
| author | Michael Williamson <mike@zwobble.org> | 2021-08-01 10:54:37 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2021-08-01 10:54:37 +0100 |
| commit | eab2eee51d21344d168adaeb72a5e0f2d418b3cd (patch) | |
| tree | 0231ce51ab7b737127685a732bcc7bafe1e73bb0 /lib/raw-text.js | |
| parent | 6f0a685d9d03343184088565feb12a1e947684af (diff) | |
Convert tab elements to tab characters
Diffstat (limited to 'lib/raw-text.js')
| -rw-r--r-- | lib/raw-text.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/raw-text.js b/lib/raw-text.js index da9a640..138b73c 100644 --- a/lib/raw-text.js +++ b/lib/raw-text.js @@ -1,6 +1,10 @@ +var documents = require("./documents"); + function convertElementToRawText(element) { if (element.type === "text") { return element.value; + } else if (element.type === documents.types.tab) { + return "\t"; } else { var tail = element.type === "paragraph" ? "\n\n" : ""; return (element.children || []).map(convertElementToRawText).join("") + tail; |
