generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Import improvements #82
Open
iLiftALot
wants to merge
18
commits into
jgchristopher:main
Choose a base branch
from
iLiftALot:Import-Improvements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…f the 'description' URL parameter.
…in on my MacOS. I am now back to seamlessly extracting web clips with 1 click on both Chrome and Safari. No issues with comments either. All grouped by base URL.
Change LogTable of Contents
Documentation
Readability
Environment/DependenciesI added the following two development-dependent packages: They're very useful packages for development within Obsidian, but definitely not a deal breaker if you don't want to use them. In the event you'd like to make a merge, let me know if you'd like them taken out. Additions
Features
File-Specific Changes & Optimizationsadvancednoteentry.ts
index.ts
headingSettings Object Iteration Object.entries(headingSettings).forEach(([heading, prefix]) => {
const level = heading.slice(1); // Extract the number from 'h1', 'h2', etc.
const filter = [`h${level}`] as (keyof HTMLElementTagNameMap)[];
markdownService.addRule(`heading_${level}_update`, {
filter: filter,
replacement: function (content: string) {
return `${prefix} ${content}`;
},
});
});
Defining Description Parameter // Attempt to extract description from tag which contains page description on many websites
// Worked for me almost every time, but not 100%
const description = document.querySelector('meta[name="description"]')?.getAttribute('content') ?? '';
main.ts
Further updates will be added if necessary, but I should be done today. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had come back to this plugin after a long break of not using it and was pleased to see it had improved. However, I could not get the web-clips to import without using commands directly within the command pallet.
Advanced Clips
I started by fixing a lot of asynchronous functions that were being called without being awaited, potentially messing with the flow of execution. I also changed some of the structure.
Additionally, I added in some extra variables which can be extracted from the constructed link.
These updates are especially convenient for those who do not use daily notes or periodic notes. It now allows me to simply click the button and import the data to my specified "Advanced" setting directory, always within the file which is named after the base URL of the specified website.
Highlights
I also could not get highlights to be included with any web clips. This feature indirectly smoothed out and works well with the advanced imports.
Conclusion
You'll see I also adjusted the structure of the imported data; that was also working very finicky. Everything formats quite nicely in my opinion with my updates, but that's personal preference.
I am now successfully importing data very quickly on both Safari and Chrome on MacOS by simply dragging the bookmark link (from the plugin "Browser" settings tab) over to the Chrome/Safari bookmark area. No special installation is required for Chrome on my end.
Let me know if you have any questions.
Thanks for making this plugin!