Skip to content

Commit

Permalink
Resolve issue with backslash escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
danielunited committed May 24, 2023
1 parent a41be41 commit 996013c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/components/LocalEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ export default class LocalEditor extends React.Component {
}

updateMarkdown() {
let markdown = this.state.note.content.text.replace(/(\n{2})(\n+)(?!:::)(?!---)/g, (m, p, q) => p + q.replace(/(\n)/g, "\\$1"));
let markdown = this.state.note.content.text.split("\n").join("\\n");

if (markdown === "") {
markdown = "\n";
}

this.setState({ markdown });
}

Expand Down

1 comment on commit 996013c

@vercel
Copy link

@vercel vercel bot commented on 996013c May 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.