No need for the time being, I need to look at the code first, after all, the implementation may not be exactly the same. For example, the action required for the vscode plug-in to click on the joplin link is: Query the note to determine whether it exists => Open the note in the editor, and modify it at the same timeNot only the markdown rendering part, but also the Ctrl+click action in the markdown source file
Tried again, but for me the issue remains, unfortunately.
Joplin's token/port is set incorrectly, unable to access Joplin service!
I'll keep trying
Under what circumstances are web cliper available, but curl http://127.0.0.1:41184/ping
will fail? Is there any way to determine what went wrong? @laurent
ref link: Joplin's vscode plugin is released!
Sorry, although this is not the scope of the problem that the plug-in needs to solve, I will contact laurent to ask if there are any feasible solutions for testing problems, such as uploading logs.
This message “Joplin’s token/port is set incorrectly, unable to access Joplin service!” is not from Joplin. The app will provide proper http status code and error message when possible, so as a first step you could display this to the user as that might help understand what’s happening.
If curl fails, the plug-in cannot request it normally, right?
Yes I guess if the port is invalid or the server not running you wouldn’t get any proper error.
Sorry for the late response and confusion.
But yes, this is what I was referring to. Being able to click a link to note inside of another note.
The [note name](:/note_identifier)
links.
Not sure how helpful this is but running Mac OS Catalina - same issue with the token/port on VS Code. Tried changing the port around/re-entering. This doesn’t work on the most recent Joplin or the pre-release version.
Thank you so much for this! I also much prefer VS Code’s interface, but I like Joplin’s mobile app and synchronization support.
Just opened up VS Code Joplin plugin and it seems to be working, looks like a recent update has fixed the problems.
Now I just gotta figure out how to configure the split screen and markdown shortcuts to work!
So, you can take a look: https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
Looks great!
Do you think it is possible to make hyperlinks to other Joplin notes work with your plugin?
Yes, if this feature is really so commonly used. . .
Barro350 via Joplin Forum <cozic@discoursemail.com> 于 2020年9月3日周四 上午6:47写道:
It has been updated, simply based on the vscode schema url to implement a note reference function. Considering that the format of :id
compatible with Joplin needs to modify the markdown rendering and the difficulty of the vscode editor (ctrl+click support), it is not compatible with joplin yet. @barro350 @Bruised
Thanks for the update, @rxliuli.
Since I use Joplin in my Android phone as often as in a desktop, I really hope that links written in Joplin app are compatible with the vscode extension.
Modifying Markdown rendering should not be too difficult. Since VS Code uses markdown-it and it provides a way to extend the default markdown renderer, I guess something like the below (taken from here) will suffice? (It works in browsers, at least.)
var md = markdownit();
// Default renderer
var defaultRender = md.renderer.rules.link_open || function(tokens, idx, options, env, self) {
return self.renderToken(tokens, idx, options);
};
md.renderer.rules.link_open = function (tokens, idx, options, env, self) {
var aIndex = tokens[idx].attrIndex('href');
if (aIndex >= 0) {
var linkUrl = tokens[idx].attrs[aIndex][1];
var regexMatch = linkUrl.match(/^:\/([0-9a-f]+)$/);
if(regexMatch)
tokens[idx].attrs[aIndex][1] = 'vscode://' + regexMatch[1];
}
// pass token to default renderer.
return defaultRender(tokens, idx, options, env, self);
};
Could you please consider implementing the custom Markdown rendering like the above code? I understand that (i) the link will work only in the preview pane and (ii) it will open the source file in the preview pane. Still, it will enable the cross-linking written in Joplin to work in your vscode plugin as well. What do you think?
That way, I can't use Ctrl+click in the editor to open the Joplin link in VSCode. . .I may need to modify the editor, but I strongly recommend that Joplin’s internal reference links be modified to joplin://note/:id (someone has already mentioned) instead of direct :id, otherwise it may conflict with other tools (such as docsify )
In addition, I am not familiar with markdown-it, so I find it troublesome. Although it is very simple for people who know, I will try to modify it as soon as possible.
This is a new version, but the experience is not good, it is better to support Ctrl+Click
I found that vscode uses a hidden attribute ‘data-href’ in the <a href ...>
tag. Ctrl+Click works only if href
and data-href
point to the same URI.
I have made a simple PR to fix this, please have a look at it. Now Ctrl+Click works as intended. Although it opens a source (Markdown) file in the preview pane, dragging the tab into the source pane generates the HTML preview automatically.
By the way, I guess the tag v0.1.6
in your Github points to a wrong commit? The source code for v0.1.5
and v0.1.6
are exactly the same.
Actually, what I mean by Ctrl+click is…(•̀ω•́ 」∠)