Skip to content

Commit d438cbf

Browse files
committed
Bump version to 0.0.5 and update README to describe new Generate Markdown and Download Content features
1 parent 781735e commit d438cbf

5 files changed

Lines changed: 27 additions & 8 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ When you first open the plugin, the sample query will provide results in the exp
3535
]
3636
```
3737

38+
## Generating Markdown
39+
40+
The "Generate Markdown" button converts the JSON query results into markdown format and displays it in the query-result area. This allows you to preview the markdown before downloading it.
41+
3842
### Page and Hash References Processing
3943

4044
When exporting query results to markdown, you can customize how page references (`[[]]`) and hash references (`#`) are handled. The available options are:
@@ -44,3 +48,8 @@ When exporting query results to markdown, you can customize how page references
4448
- **Delete**: Remove the references entirely.
4549

4650

51+
### Download Content
52+
53+
The "Download Content" button downloads the current content of the query-result area. This could be either the JSON query results or the generated markdown, depending on what is currently displayed.
54+
55+

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "logseq-query-exporter",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"main": "public/index.html",
55
"author": "benrhughes",
66
"scripts": {

screenshot.png

-250 KB
Binary file not shown.

screnshot.png

259 KB
Loading

src/Repl.svelte

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
2222
let res: ReturnType<typeof runQuery>;
2323
let sortedResults: any[] = [];
24+
let queryResult: string = '';
2425
2526
function executeQuery() {
2627
res = runQuery()
2728
.then((result) => {
2829
sortedResults = sortResult(result?.map(([item]) => item));
30+
queryResult = JSON.stringify(sortedResults, null, 2); // Set queryResult to display JSON by default
2931
});
3032
}
3133
@@ -54,7 +56,7 @@
5456
}
5557
}
5658
57-
function downloadMarkdown() {
59+
function generateMarkdown() {
5860
if (!sortedResults.length) return;
5961
6062
const markdownContent = sortedResults
@@ -78,8 +80,14 @@
7880
})
7981
.join('\n\n---\n\n');
8082
81-
const blob = new Blob([markdownContent], { type: 'text/markdown;charset=utf-8' });
82-
saveAs(blob, 'results.md');
83+
queryResult = markdownContent; // Update the query-result area with markdown
84+
}
85+
86+
function downloadContent() {
87+
if (!queryResult) return;
88+
89+
const blob = new Blob([queryResult], { type: 'text/plain;charset=utf-8' });
90+
saveAs(blob, 'results.txt');
8391
}
8492
</script>
8593

@@ -90,8 +98,8 @@
9098
<div class="control-group">
9199
<label for="sort-order">Sort Order:</label>
92100
<select id="sort-order" bind:value={sortOrder}>
93-
<option value="asc">Sort Asc</option>
94-
<option value="desc">Sort Desc</option>
101+
<option value="asc">Asc</option>
102+
<option value="desc">Desc</option>
95103
</select>
96104
</div>
97105
<div class="control-group">
@@ -115,15 +123,17 @@
115123
</select>
116124
</div>
117125
<div class="control-group">
118-
<button on:click={downloadMarkdown}>Download as Markdown</button>
126+
<button on:click={generateMarkdown}>Generate Markdown</button>
127+
<div class="vertical-separator"></div>
128+
<button on:click={downloadContent}>Download Content</button>
119129
</div>
120130
</div>
121131
</div>
122132
<div class="query-result">
123133
{#await res}
124134
<pre>...running query</pre>
125135
{:then result}
126-
<pre>{JSON.stringify(sortedResults, null, 2)}</pre>
136+
<pre>{queryResult}</pre>
127137
{:catch error}
128138
<pre class="error">{error.message}</pre>
129139
{/await}

0 commit comments

Comments
 (0)