Comments (4)
changing the code to print a bit:
for l in re.findall(r'^(\<inclusion href="[^"]*" />)', self.page, re.MULTILINE):
link = l.replace('<inclusion href="', '').replace('" />', '')
link_lookup = GetObsidianFilePath(link, self.file_tree)
print(link)
print(link_lookup[0])
print(link_lookup[1])
file_record = link_lookup[1]
if len(link_lookup) >= 3:
print(link_lookup[2])
header = link_lookup[2]
results in:
Hymey.jpg|300
Hymey.jpg.md
False
Traceback (most recent call last):
File "/opt/homebrew/bin/obsidianhtml", line 8, in <module>
sys.exit(main())
File "/opt/homebrew/lib/python3.9/site-packages/obsidianhtml/__init__.py", line 365, in main
recurseObisidianToMarkdown(str(paths['obsidian_entrypoint']), pb)
File "/opt/homebrew/lib/python3.9/site-packages/obsidianhtml/__init__.py", line 75, in recurseObisidianToMarkdown
recurseObisidianToMarkdown(files[link_path]['fullpath'], pb)
File "/opt/homebrew/lib/python3.9/site-packages/obsidianhtml/__init__.py", line 75, in recurseObisidianToMarkdown
recurseObisidianToMarkdown(files[link_path]['fullpath'], pb)
File "/opt/homebrew/lib/python3.9/site-packages/obsidianhtml/__init__.py", line 49, in recurseObisidianToMarkdown
md.ConvertObsidianPageToMarkdownPage(paths['md_folder'], paths['obsidian_entrypoint'])
File "/opt/homebrew/lib/python3.9/site-packages/obsidianhtml/MarkdownPage.py", line 288, in ConvertObsidianPageToMarkdownPage
self.links.append(file_record['fullpath'])
TypeError: 'bool' object is not subscriptable
from obsidian-html.
Hi @jcolson thanks for your bug report.
This bug/issue has to do with the fact that code inclusions and images both use the same tags.
For example, you can create an inclusion of a page by doing ![[Note name]]
, and you can include an image by doing ![[Hymey.jpg]]
.
Now to discern between the two is done naively by looking at the suffix of the link:
obsidian-html/obsidianhtml/MarkdownPage.py
Line 125 in 1659b6e
Now, the problem is that you've used ![[Hymey.jpg|300]]
. This is a feature that I wasn't aware of. It's for setting the width it looks like? My code is too dumb to account for this. I could replicate your issue by adding |300
behind a local image.
A simple fix should be to change the code above to:
if len(link.split('.')) == 1 or link.split('.')[-1].split('|')[0] not in image_suffixes:
Notice the .split('|')[0]
The next issue would be the following block, which needs a similar cleanup step:
obsidian-html/obsidianhtml/MarkdownPage.py
Lines 134 to 138 in 1659b6e
I've added these changes to c11e004 and tested it, this works for me.
Note that now the size annotation gets stripped. If you need this to carry over into the html output please make another issue for that (feature request), because that will take some more time to get done right.
I'll keep this issue open to remind me to fix the fact that this part of the code gives a very cryptic error at moment when an image gets parsed wrong.
Let me know if this fix works for you too!
(n.b. the pypi package isn't updated yet so use the git code directly)
from obsidian-html.
Looked into it, and for now there isn't really a good solution to the error except for just making sure that the function always returns the same type of struct. There is a whole flow to parsing and there isn't one point or one check that can make sure we get better errors in the future. If anything the fact that it bugged out here made it easy to find the problem.
Setting this as solved, if anyone bumps their head on this in the future maybe we can revisit it.
from obsidian-html.
adding 'pdf' to image_suffixes = ['jpg', 'jpeg', 'gif', 'png', 'bmp']
seems to resolve.
from obsidian-html.
Related Issues (20)
- Links of files ending with question marks not generated in Breadcrumbs HOT 2
- filter_on_metadata not working HOT 5
- Request for using non-tag metadata in filter_on_metadata module HOT 3
- Better way of maintaining config files HOT 5
- ESC not available on smartphones HOT 3
- Text height calculation HOT 3
- Inline code nested in code- or latex-blocks is not restored properly HOT 4
- Non-ASCII characters are not recognized as tags and become h1 HOT 1
- Have all output follow verbosity settings
- Feature Request, inline css and js
- Links with Unicode chars (including hashpart) do not work -- slugified to empty string or single #
- Development stop ObsidianHtml HOT 3
- Excalidraw Drawings not rendered HOT 1
- question: Customizing navigation panel on left-hand side of a website? HOT 1
- Different style for transcluded blocks HOT 7
- Configfiles with encoding 'UTF-8' are parsed correctly even if the path does contain invalidly-encoded chars HOT 2
- Developer Docs - apparent incongruence between existing codebase formatting and results of documented lint operations? HOT 5
- Separator line in notes with frontmatter is ignored
- Rendering Mermaid diagrams with title
- issue with `slugify_html_links` config and directory paths
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from obsidian-html.