Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images are not included with HtML export #138

Open
wealthychef1 opened this issue Sep 3, 2022 · 12 comments
Open

Images are not included with HtML export #138

wealthychef1 opened this issue Sep 3, 2022 · 12 comments

Comments

@wealthychef1
Copy link

wealthychef1 commented Sep 3, 2022

Hello, I'm trying to export this file from my vault as HTML.
The images are not included in the resulting HTML output.
I feel like I must be making a mistake. Can someone point out my error? Thank you.

---
Aliases: [   ]
tags: 
created: 2022-08-31
# Note refactored from [[Apple Watch is not collecting respiratory data for AutoSleep app]] 
---
#  Putting Apple Watch into Sleep mode for respiratory data
 - Apple appears to require that the watch be put into a special mode called "Sleep" which is of course different from "sleep" as applied to MacOS or iOS. 
1. First set up a sleep schedule in Health, which is just a declarative process; Apple does nothing much with it. 
	1. I suppose being conscious is perhaps the heart of measurement, so this does have a benefit for self discipline, whatever benefit Apple intends.  
2. On the watch, swipe up, select the moon icon
	1. ![[4F9FC2B4-E310-40AF-AFA6-B9DDA9A3C10B_1_201_a.jpeg|200]]
3. we see that now it presents a choice between "Sleep" and "Do Not Disturb." Choose "Sleep."
	1. ![[B89FBF45-E83F-444A-B74F-371EB0DB8730.png|200]]
4. Now the Moon has changed to a bed.  
	1. Meaning?  You are sort of "likely to be sleeping" as far as Apple is concerned.  Weird gray area here. 
		1.  ![[E718F31D-4691-41B3-8D23-D48696EC3F28.png|200]]
5.  The watch now is going to collect respiratory data (all the time? unknown)
6. Autosleep and Health now show the respiratory data. 
7. Support told me, before we were cut off due to poor reception in TJ, that sleep schedules and the Sleep function on the watch functioned as a hint from me to the OS. 
	1. Actually, it's more than this, see [[#Collection of data]]
	2. I imagine perhaps taking respiratory measurements uses more power, but later call shed doubt on this idea.  
8. Feels a bit like terrible design by Apple.  Needs improvement.  They keep getting the basic things wrong, LOL

### Collection of data
- Respiratory rate is calculated from blood oxygen levels
- In the watch app, the Blood Oxygen setting allows control of when it's collected
	- During sleep focus and/or during Theatre Mode
	- ![[09451C84-DDD3-4A2C-868B-D84C54B26778_1_105_c.jpeg|150]]
- In addition computation and availability of respiratory rate requires:
	- I'm not physically in motion.  
	- Phone has to be inactive.  
	- Phone needs to be charging as well.  
	- Watch has to be in Sleep mode
		- This happens automatically at the start of the Sleep Schedule from the iOS Health app.  
		- This mode is only available if there is an existing sleep schedule. 
	- The devices will then use motion and other data to drive further analyses

### Next update should improve things
- The next update (iOS 16) is better in terms of measurements  

### The utility of setting an extended sleep schedule  
- I considered setting my sleep schedule to be all day, but I think that's not necessary.  
- Sleep mode on the watch is available outside the schedule, just needs to be manually enabled.  
- Since my schedule is in fact variable, I have to just remember to set Sleep mode when I lay down, not a big deal.  

Why is it that the "export as HTML" option says "(without Pandoc)"?
2022-09-03 09 33 50 CleanShot Obsidian

@mathisgauthey
Copy link

Same problem, even though I added the pandoc path to my config. Don't know what is happening.

@evolve2k
Copy link

Not sure where I read it, but aparently Obsidians default image markup is not proper Markdown and is not compatable with pandoc.

@wealthychef1
Copy link
Author

wealthychef1 commented Oct 20, 2022

Not sure where I read it, but aparently Obsidians default image markup is not proper Markdown and is not compatable with pandoc.

I believe you are incorrect on this point. From what I can see Obsidian.md follows the standard to the letter if you don't use wiki formatting. But even if it deviates slightly, I wonder if it would be hard to add support for this minor syntax change in the plugin outside of pandoc.

https://www.markdownguide.org/basic-syntax/#images-1.

@evolve2k
Copy link

@wealthychef1 I'll take back if this is correct Markdown or not, looks like it is from your reference.
The issue I was highlighting is that others are saying this is not Markdown that Pandoc recognises (who knows why 🤷‍♂️).

My initial searches on this issue kept bringing up threads with no clear answers (like this one).
Here's a few links to where I've found more useful discussion:
#81 (comment)
#66 (comment)

Trick seems to be:

  1. Make Pandoc happy by swapping the image format from the Obsidian default over to the link format

Converted ![[Obsidian image links]] to ![Markdown image links](/path/to/image.png)
Try it yourself if your skeptical. Yes this is more a workaround than FIX.

  1. Pandoc starts to complain it cant find your images.
    Seems to be an issue of recognising spaces in file paths and also actually findings and sharing one place to keep all your files. Folks seem to be saving a YAML config file with the path in it and changing a setting so all future images are saved to the new /images or /assets folder or whatever.

Follow the links above for more discussion.

@wealthychef1
Copy link
Author

@wealthychef1 I'll take back if this is correct Markdown or not, looks like it is from your reference. The issue I was highlighting is that others are saying this is not Markdown that Pandoc recognises (who knows why 🤷‍♂️).

Right, I get it.

My initial searches on this issue kept bringing up threads with no clear answers (like this one). Here's a few links to where I've found more useful discussion: #81 (comment) #66 (comment)

  1. Make Pandoc happy by swapping the image format from the Obsidian default over to the link format
  2. Pandoc starts to complain it cant find your images.
    Follow the links above for more discussion.

I did but now I'm getting a new error when I try to export in version 1.0. In the console I see this, which I guess github refuses to wrap, sorry about the long lines:

cmd: /opt/local/bin/pandoc -f markdown --resource-path="/Volumes/2_TB_SSD_external/Projects_2TB/computers-and-geekery/projects and languages/Obsidian development/wealthyvault/Knowledge/Politics Economics and History/US Electoral Politics/Politicians" --resource-path="assets" --embed-resources --standalone --metadata title="Alexandria Ocasio-Cortez or AOC" -s -o "/Users/rcook/Downloads/Alexandria Ocasio-Cortez or AOC.pdf" -t pdf  "/Volumes/2_TB_SSD_external/Projects_2TB/computers-and-geekery/projects and languages/Obsidian development/wealthyvault/Knowledge/Politics Economics and History/US Electoral Politics/Politicians/Alexandria Ocasio-Cortez or AOC.md"
 error: Command failed: /opt/local/bin/pandoc -f markdown --resource-path="/Volumes/2_TB_SSD_external/Projects_2TB/computers-and-geekery/projects and languages/Obsidian development/wealthyvault/Knowledge/Politics Economics and History/US Electoral Politics/Politicians" --resource-path="assets" --embed-resources --standalone --metadata title="Alexandria Ocasio-Cortez or AOC" -s -o "/Users/rcook/Downloads/Alexandria Ocasio-Cortez or AOC.pdf" -t pdf  "/Volumes/2_TB_SSD_external/Projects_2TB/computers-and-geekery/projects and languages/Obsidian development/wealthyvault/Knowledge/Politics Economics and History/US Electoral Politics/Politicians/Alexandria Ocasio-Cortez or AOC.md"
pandoc: pdflatex: createProcess: posix_spawnp: illegal operation (Inappropriate ioctl for device)

@wealthychef1
Copy link
Author

OK now it seems I can simply export to PDF using File -> Export PDF, which is a command that strangely does not exist from the usual Obsidian command palette. Strange.

File -> Export PDF

2022-10-25 21 37 00 CleanShot Obsidian

Not in command palette?

2022-10-25 21 37 27 CleanShot Obsidian

@hberge
Copy link

hberge commented Jan 3, 2024

At the minute I am looking at a similar issue. I get no images but they are referenced in the HTML. I noticed my exported HTML was lacking variables in the CSS :root. Through modification of the plugin code I found that the getAppConfig() function was failing, because on my system there is no file called "config" in the .obsidian folder. What I have are multiple files ("app.json", "appearance.json", etc.).

async function getAppConfig(vaultBasePath: string): Promise<any> {
return JSON.parse((await fs.promises.readFile(path.join(vaultBasePath, '.obsidian', 'config'))).toString());
}

@hberge
Copy link

hberge commented Jan 3, 2024

A few more notes on various things I found:

  • In getAppConfig(), changing 'config' to 'appearance.json' can provide the theme config value as well as cssTheme which is not used by this plugin, but theme is only present and set to 'moonstone' if the current theme is light. For dark it is missing. The code assumes the theme value to be 'obsidian' if the theme is light.
  • I could have images in the export HTML if the following were true:
    • The images needed to be embedded directly in the file and with a relative path from the exported file. E.g. ![[fig/image-file.svg]] would work since I had images in the fig/ folder.
  • I still did not see images in the embeds however. E.g. I was embedding files that contained embedded images - these were not showing. Instead of <img> in the html I was getting two different things:
    • When I used the markdown reference ![Figure: Caption text](fig/image-file.svg "Caption text") I got HTML output <div alt="Figure: Caption text" src="fig/image-file.svg" class="internal-embed"></div>
    • When I used the markdown reference ![[fig/image-file.svg]] I got <span alt="fig/image-file.svg" src="fig/image-file.svg" class="internal-embed">fig/image-file.svg</span>

@afganrasulov
Copy link

Found the solution

I had the same problem, and I think I found the solution. I recorded a video to help you out. Here is the link: https://youtu.be/pKawg6mPWE4

@evolve2k
Copy link

evolve2k commented Jul 31, 2024

@wealthychef1

I did but now I'm getting a new error when I try to export in version 1.0. In the console I see this, which I guess github refuses to wrap, sorry about the long lines: * SEE EXAMPLE ABOVE*

From your path:

--resource-path="/Volumes/2_TB_SSD_external/Projects_2TB/computers-and-geekery/projects and languages/...,

Yeah I think the issue now is the folders with spaces.. the first in your path being "projects and languages".
To workaround shuffle things around until you have a path with no folders with spaces in.

@kirscheGIT
Copy link

Found the solution

I had the same problem, and I think I found the solution. I recorded a video to help you out. Here is the link: https://youtu.be/pKawg6mPWE4

You are the man. This worked for me!

@cdriveraus
Copy link

Some kind of warning about attachments with spaces in them would be useful! Renaming all my attachments worked...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants