Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/archivist/extract/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
if (sourceDocument.mimeType == mime.getType('pdf')) {
return await extractFromPDF(sourceDocument);
}
if (sourceDocument.mimeType == mime.getType('txt') || sourceDocument.mimeType == mime.getType('md')) {
return await extractFromMd(sourceDocument);
}

return await extractFromHTML(sourceDocument);
} catch (error) {
Expand Down Expand Up @@ -126,6 +129,14 @@
return markdownContent;
}

export async function extractFromMd({ location, content: markdownContent }) {

Check warning on line 132 in src/archivist/extract/index.js

View workflow job for this annotation

GitHub Actions / test (windows-latest)

Async function 'extractFromMd' has no 'await' expression

Check warning on line 132 in src/archivist/extract/index.js

View workflow job for this annotation

GitHub Actions / test (macos-latest)

Async function 'extractFromMd' has no 'await' expression

Check warning on line 132 in src/archivist/extract/index.js

View workflow job for this annotation

GitHub Actions / test (ubuntu-22.04)

Async function 'extractFromMd' has no 'await' expression
if (!markdownContent) {
throw new Error(`The markdown file at '${location}' contains no text`);
}

return markdownContent;
}

function selectRange(webPageDOM, rangeSelector) {
const { startBefore, startAfter, endBefore, endAfter } = rangeSelector;

Expand Down
Loading