In certain documents, there is text wrapping used in the markdown document that is not displayed on the website. For example: https://github.com/Thenlie/mdnman/blob/main/lib/javascript/web_api/window/status/index.md?plain=1#L13
Create a function to remove these text wraps without breaking any other line breaks.
A naïve attempt to do this was already made.
const removeTextWrapping = (document: string) => {
return document.replace(/([^\n])\n(?=\S)/g, '$1 ');
};
This approach does not account for codeblocks or block quotes, and likely some other edge cases. Ensure the function properly handles the following cases:
→ Input
However, the HTML standard now requires
setting `window.status` to have no effect on the text displayed in the
status bar.
← Output
However, the HTML standard now requires setting `window.status` to have no effect on the text displayed in the status bar.
→ Input
```js
let foo = 42; // foo is now a number
foo = "bar"; // foo is now a string
foo = true; // foo is now a boolean
`` `
← Output
```js
let foo = 42; // foo is now a number
foo = "bar"; // foo is now a string
foo = true; // foo is now a boolean
`` `
→ Input
> This is a
> Block quote that
> Should not be split up
← Output
> This is a
> Block quote that
> Should not be split up
In certain documents, there is text wrapping used in the markdown document that is not displayed on the website. For example: https://github.com/Thenlie/mdnman/blob/main/lib/javascript/web_api/window/status/index.md?plain=1#L13
Create a function to remove these text wraps without breaking any other line breaks.
A naïve attempt to do this was already made.
This approach does not account for codeblocks or block quotes, and likely some other edge cases. Ensure the function properly handles the following cases: