OliverBalfour / obsidian-pandoc

Pandoc document export plugin for Obsidian (https://obsidian.md)
MIT License
717 stars 60 forks source link

Images are not included with HtML export #138

Open wealthychef1 opened 2 years ago

wealthychef1 commented 2 years ago

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 commented 2 years ago

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

evolve2k commented 2 years ago

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

wealthychef1 commented 2 years ago

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 commented 2 years ago

@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: https://github.com/OliverBalfour/obsidian-pandoc/issues/81#issuecomment-1013729587 https://github.com/OliverBalfour/obsidian-pandoc/issues/66#issuecomment-1013519239

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 commented 2 years ago

@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 commented 2 years ago

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 commented 10 months ago

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.).

https://github.com/OliverBalfour/obsidian-pandoc/blob/68ff9e3733cc73055156455721fc736ad45c7d5e/renderer.ts#L91-L93

hberge commented 10 months ago

A few more notes on various things I found:

afganrasulov commented 4 months ago

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 commented 3 months ago

@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 commented 2 months ago

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 commented 1 month ago

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