1 | //
|
2 |
|
3 | const Client = require("@minodisk/medkit");
|
4 | const { html2md } = require("@minodisk/medmd");
|
5 | const { toText } = require("./format");
|
6 |
|
7 | module.exports = (client, postId) => {
|
8 | return new Promise(async (resolve, reject) => {
|
9 | const { html, options } = await client.readPost(postId);
|
10 | await client.close();
|
11 | const body = await html2md(html);
|
12 | resolve(toText({ meta: { id: postId, ...options }, body }));
|
13 | });
|
14 | };
|