Skip to content

Commit 69e5509

Browse files
committed
Remove auto formatting
1 parent 0aa9d1a commit 69e5509

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

__test__/text-node-to-html.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('Text Node To HTML', () => {
1515
...textNode,
1616
bold: true
1717
}
18-
18+
1919
const resultHtml = textNodeToHTML(node, {
2020
...defaultNodeOption
2121
})
@@ -226,4 +226,4 @@ describe('Text Node To HTML', () => {
226226
expect(resultHtml).toEqual(`<mark>${textNode.text}</mark>`)
227227
done()
228228
})
229-
})
229+
})

src/helper/enumerate-entries.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ export function enumerateContents(
4444

4545
export function textNodeToHTML(node: TextNode, renderOption: RenderOption): string {
4646
let text = replaceHtmlEntities(node.text);
47-
47+
4848
// Convert newlines to <br /> tags if there are no other marks
4949
// This ensures newlines are always handled consistently
5050
let hasMarks = false;
51-
51+
5252
if (node.classname || node.id) {
5353
text = (renderOption[MarkType.CLASSNAME_OR_ID] as RenderMark)(text, node.classname, node.id);
5454
hasMarks = true;
@@ -89,12 +89,12 @@ export function textNodeToHTML(node: TextNode, renderOption: RenderOption): stri
8989
text = (renderOption[MarkType.HIGHLIGHT] as RenderMark)(text);
9090
hasMarks = true;
9191
}
92-
92+
9393
// If no marks were applied, but text contains newlines, convert them to <br />
9494
if (!hasMarks && text.includes('\n')) {
9595
text = text.replace(/\n/g, '<br />');
9696
}
97-
97+
9898
return text;
9999
}
100100
export function referenceToHTML(
@@ -125,7 +125,7 @@ export function referenceToHTML(
125125
const aTag = `<a${aTagAttrs}>${entryText}</a>`;
126126
return aTag;
127127
}
128-
128+
129129
if (!renderEmbed && renderOption[node.type] !== undefined) {
130130
return sendToRenderOption(node);
131131
}
@@ -140,7 +140,7 @@ export function referenceToHTML(
140140
if (!item && renderOption[node.type] !== undefined) {
141141
return sendToRenderOption(node);
142142
}
143-
143+
144144
return findRenderString(item, metadata, renderOption);
145145

146146
}
@@ -188,4 +188,4 @@ function nodeToHTML(
188188
return (renderOption.default as RenderNode)(node, next);
189189
}
190190
}
191-
}
191+
}

src/nodes/mark-type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ enum MarkType {
1414
BREAK = 'break'
1515
}
1616

17-
export default MarkType
17+
export default MarkType

src/options/default-node-options.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function getAttrString(node: Node, key: string): string | undefined {
2424
*/
2525
function buildCommonAttrs(node: Node): string {
2626
if (!node.attrs) return '';
27-
27+
2828
const attrs: string[] = [];
2929
if (node.attrs.style) {
3030
attrs.push(` style="${node.attrs.style}"`);
@@ -134,7 +134,7 @@ export const defaultNodeOption: RenderOption = {
134134
});
135135
colgroupHTML += `</${NodeType.COL_GROUP}>`;
136136
}
137-
137+
138138
// Generate table with colgroup and other attributes
139139
return `<table${buildCommonAttrs(node)}>${colgroupHTML}${sanitizeHTML(next(node.children))}</table>`;
140140
},
@@ -157,7 +157,7 @@ export const defaultNodeOption: RenderOption = {
157157
const colSpan = getAttr(node, 'colSpan');
158158
const rowSpanAttr = rowSpan ? ` rowspan="${rowSpan}"` : '';
159159
const colSpanAttr = colSpan ? ` colspan="${colSpan}"` : '';
160-
160+
161161
return `<th${rowSpanAttr}${colSpanAttr}${buildCommonAttrs(node)}>${sanitizeHTML(next(node.children))}</th>`
162162
},
163163
[NodeType.TABLE_DATA]:(node: Node, next: Next) => {
@@ -167,7 +167,7 @@ export const defaultNodeOption: RenderOption = {
167167
const colSpan = getAttr(node, 'colSpan');
168168
const rowSpanAttr = rowSpan ? ` rowspan="${rowSpan}"` : '';
169169
const colSpanAttr = colSpan ? ` colspan="${colSpan}"` : '';
170-
170+
171171
return `<td${rowSpanAttr}${colSpanAttr}${buildCommonAttrs(node)}>${sanitizeHTML(next(node.children))}</td>`
172172
},
173173
[NodeType.BLOCK_QUOTE]:(node: Node, next: Next) => {
@@ -180,12 +180,12 @@ export const defaultNodeOption: RenderOption = {
180180
['reference']:(node: Node, next: Next) => {
181181
const type = getAttr(node, 'type');
182182
const displayType = getAttr(node, 'display-type');
183-
183+
184184
if ((type === 'entry' || type === 'asset') && displayType === 'link'){
185185
const href = getAttrString(node, 'href') || getAttrString(node, 'url') || '';
186186
const target = getAttrString(node, 'target');
187187
const assetUid = getAttrString(node, 'asset-uid');
188-
188+
189189
let aTagAttrs = buildCommonAttrs(node);
190190
if (href) aTagAttrs += ` href="${href}"`;
191191
if (target) {
@@ -200,7 +200,7 @@ export const defaultNodeOption: RenderOption = {
200200
}
201201
return `<a${aTagAttrs}>${sanitizeHTML(next(node.children))}</a>`;
202202
}
203-
203+
204204
if (type === 'asset') {
205205
const assetLink = getAttrString(node, 'asset-link');
206206
const src = assetLink ? encodeURI(assetLink) : '';
@@ -219,7 +219,7 @@ export const defaultNodeOption: RenderOption = {
219219
const altAttr = alt ? ` alt="${alt}"` : '';
220220
const targetAttr = target === "_blank" ? ` target="_blank"` : '';
221221
const styleAttr = style ? ` style="${style}"` : '';
222-
222+
223223
const imageTag = `<img${assetUidAttr}${classAttr}${srcAttr}${altAttr}${targetAttr}${styleAttr} />`;
224224
const styleAttrFig = style ? ` style="${style}"` : '';
225225

0 commit comments

Comments
 (0)