Wrap content in ENML if it's not already
(content: string)
| 429 | |
| 430 | /** Wrap content in ENML if it's not already */ |
| 431 | function wrapInEnml(content: string): string { |
| 432 | if (content.includes('<!DOCTYPE en-note')) { |
| 433 | return content |
| 434 | } |
| 435 | const escaped = content |
| 436 | .replace(/&/g, '&') |
| 437 | .replace(/</g, '<') |
| 438 | .replace(/>/g, '>') |
| 439 | .replace(/\n/g, '<br/>') |
| 440 | return `<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd"><en-note>${escaped}</en-note>` |
| 441 | } |
| 442 | |
| 443 | export async function createNote( |
| 444 | token: string, |
no test coverage detected