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.
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
generate copy without wikilinks #1365
generate copy without wikilinks #1365
Changes from 7 commits
60b4adf
bab6cd7
bcfde0e
76ed1ad
07702c2
62f458e
0aefd72
2e350d7
08451f1
18dbbb5
b384491
7adf32f
4483132
8dd26c9
7732e4b
8194b5c
6765d52
1daf3be
aaa8321
bdfa676
7af316b
e8e3c2a
b9775a3
866a091
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 16 in packages/foam-vscode/src/core/janitor/convert-links-format.ts
GitHub Actions / Spell Check with Typos
Check warning on line 91 in packages/foam-vscode/src/core/janitor/convert-links-format.ts
GitHub Actions / Spell Check with Typos
Check warning on line 91 in packages/foam-vscode/src/core/janitor/convert-links-format.ts
GitHub Actions / Spell Check with Typos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested it locally, but I wonder if you could be able to replace this whole section with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's impossible. The first line of
MarkdownLink.createUpdateLinkEdit
iswhich extracts three components via regex from link.rawText based on link.type. If the pattern doesn't match, three of them may not be extracted correctly.
Moreover, when dealing with conversion from wikilink to link, we have to retrieve the relative path to target, which is usually a basename in wikilink's rawText. Therefore, we must have
workspace
andnote: Resource | URI
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good point. Basically instead in
createUpdateLinkEdit
we need to addtype?: 'wikilink' | 'link'
to thedelta
parameter, and take it from there. Does that sound good?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is one possible version. I added
type
andisEmbed
to thedelta
, which slightly affacts howcreateUpdateLinkEdit
composes newText. Please check it.differ to current code
branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you try again to import
workspace
from vscode, or useimport * from vscode
and use that?I am not introducing the
require
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(note: in my proposed approach, this check would be
link.type !== convertOption.to
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makt?