notion-to-md 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/notion-to-md.js +12 -6
- package/package.json +1 -1
package/notion-to-md.js
CHANGED
|
@@ -125,13 +125,19 @@ ${md.addTabSpace(mdBlocks.parent, nestingLevel)}
|
|
|
125
125
|
* @param {object} annotations annotation object of a notion block
|
|
126
126
|
*/
|
|
127
127
|
annotatePlainText(text, annotations) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (
|
|
128
|
+
const leading_space = text.match(/^\s*/)[0];
|
|
129
|
+
const trailing_space = text.match(/\s*$/)[0];
|
|
130
|
+
text = text.trim();
|
|
131
|
+
|
|
132
|
+
if (text !== '') {
|
|
133
|
+
if (annotations.code) text = md.inlineCode(text);
|
|
134
|
+
if (annotations.bold) text = md.bold(text);
|
|
135
|
+
if (annotations.italic) text = md.italic(text);
|
|
136
|
+
if (annotations.strikethrough) text = md.strikethrough(text);
|
|
137
|
+
if (annotations.underline) text = md.underline(text);
|
|
138
|
+
}
|
|
133
139
|
|
|
134
|
-
return text;
|
|
140
|
+
return leading_space + text + trailing_space;
|
|
135
141
|
}
|
|
136
142
|
}
|
|
137
143
|
|