mirror of
https://github.com/jzillmann/pdf-to-markdown.git
synced 2025-02-01 18:39:43 +01:00
29 lines
826 B
JavaScript
29 lines
826 B
JavaScript
import React from 'react';
|
|
import MarkdownPageView from '../../components/debug/MarkdownPageView.jsx';
|
|
import Transformation from './Transformation.jsx';
|
|
import ParseResult from '../ParseResult.jsx';
|
|
|
|
export default class ToMarkdown extends Transformation {
|
|
|
|
constructor() {
|
|
super("To Markdown", "String");
|
|
}
|
|
|
|
createPageView(page, modificationsOnly) { // eslint-disable-line no-unused-vars
|
|
return <MarkdownPageView key={ page.index } page={ page } />;
|
|
}
|
|
|
|
transform(parseResult:ParseResult) {
|
|
parseResult.pages.forEach(page => {
|
|
var text = '';
|
|
page.items.forEach(block => {
|
|
text += block.text + '\n';
|
|
});
|
|
page.items = [text];
|
|
});
|
|
return new ParseResult({
|
|
...parseResult,
|
|
});
|
|
}
|
|
|
|
} |