Skip to content

Commit

Permalink
fix: Dash parsing error
Browse files Browse the repository at this point in the history
  • Loading branch information
brunojm committed Jun 14, 2023
1 parent 61f6ac5 commit ad313b4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ interface ExportStatusResponse {
taskStatus: string,
}

function escapeDash(inputString: string): string {
// fix: https://github.com/logseq/logseq/issues/5664
if (inputString) {
return inputString.replace(/-/g, '\\-');
} else {
return inputString
}
}

function getLogseqClientID() {
let clientId = window.localStorage.getItem('rw-LogseqClientId')
if (clientId) {
Expand Down Expand Up @@ -103,7 +112,7 @@ function processBlockContent(content: string, preferredDateFormat: string) {
function convertReadwiseToIBatchBlock(preferredDateFormat: string, obj: ReadwiseBlock) {
// we ignore the first one (which we can consider as the block title)
const block: IBatchBlock = {
content: processBlockContent(obj.string, preferredDateFormat)!,
content: escapeDash(processBlockContent(obj.string, preferredDateFormat))!,
}
if (obj.children !== undefined) {
block.children = obj.children.map(partial(convertReadwiseToIBatchBlock, preferredDateFormat)).filter(
Expand Down

0 comments on commit ad313b4

Please sign in to comment.