Skip to content

Commit 04dd6e3

Browse files
committed
Don't even try to infer the title when publishing HTML - close #1
1 parent 69a0a11 commit 04dd6e3

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Currently, this plugin exposes two Commands:
1414
## Installing this plugin as a Beta Tester
1515

1616
1. Install [BRAT](https://github.com/TfTHacker/obsidian42-brat) from the Community Plugins in Obsidian
17-
2. Copy the link https://github.com/sblakey/obsidian-quip.git
17+
2. Copy the link https://github.com/sblakey/obsidian-quip
1818
3. Open the command palette and run the command **BRAT: Add a beta plugin for testing**
1919
4. Using the link from step 2, copy that into the modal that opens up
2020
5. Click on Add Plugin -- wait a few seconds and BRAT will tell you what is going on

main.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@ export default class QuipPlugin extends Plugin {
5252
// If checking is false, then we want to actually perform the operation.
5353
if (!checking) {
5454
let client = new QuipAPIClient(this.settings.hostname, this.settings.token);
55-
let title = markdownView.file.basename;
5655
// Quip import likes to replace the first heading with the document title
5756
const htmlPromise = render(this, markdownView, markdownView.file.path);
5857
htmlPromise.then((html: string) => {
5958
console.log(html);
6059
let options: NewDocumentOptions = {
6160
content: html,
62-
title: title,
61+
title: undefined,
6362
format: DocumentFormat.HTML,
6463
memberIds: undefined
6564
};
@@ -253,6 +252,16 @@ class QuipSettingTab extends PluginSettingTab {
253252
this.plugin.settings.addLink = value;
254253
await this.plugin.saveSettings();
255254
}));
255+
new Setting(containerEl)
256+
.setName('Inline embedded notes')
257+
.setDesc('Replace embed-links with the content of those notes')
258+
.addToggle(toggle => toggle
259+
.setValue(this.plugin.settings.inlineEmbeds)
260+
.onChange(async (value) => {
261+
console.log(`Add Link: ${value}`);
262+
this.plugin.settings.inlineEmbeds = value;
263+
await this.plugin.saveSettings();
264+
}));
256265
}
257266
}
258267

renderer.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,20 @@ export default async function render (plugin: QuipPlugin, view: MarkdownView,
7777
document.body.removeChild(wrapper);
7878

7979
// If it's a top level note, make the HTML a standalone document - inject CSS, a <title>, etc.
80-
const title = fileBaseName(inputFile);
8180
if (parentFiles.length === 0) {
82-
html = await standaloneHTML(html, title);
81+
html = await standaloneHTML(html);
8382
}
8483

8584
return html;
8685
}
8786

88-
async function standaloneHTML(html: string, title: string): Promise<string> {
87+
async function standaloneHTML(html: string): Promise<string> {
8988
// Wraps an HTML fragment in a proper document structure
9089
// Don't bother with CSS Quip will ignore
9190

9291
return `<!doctype html>\n` +
9392
`<html>\n` +
9493
` <head>\n` +
95-
` <title>${title}</title>\n` +
9694
` <meta charset='utf-8'/>\n` +
9795
` </head>\n` +
9896
` <body>\n` +

0 commit comments

Comments
 (0)