Skip to content
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

Feature request: Support markdown links #1

Open
1 of 3 tasks
rjgibson opened this issue Jan 17, 2021 · 8 comments
Open
1 of 3 tasks

Feature request: Support markdown links #1

rjgibson opened this issue Jan 17, 2021 · 8 comments

Comments

@rjgibson
Copy link

I recently starting using Mark Headboard. I love the simplicity and elegance!

It would be great if the cards could be markdown links. I'd like to be able to add each card as a link to a project page, followed by a list of checkbox items for that project.

For example:

Todo

proj3

Doing

proj2

  • do this
  • do that

Done

proj1

  • do this
@brokensandals
Copy link
Owner

Thanks! Yes, I'd like for it to recognize when the card titles are/contain links. This does present a bit of a UI dilemma though, because currently clicking on the card takes you to that section of the markdown document, which is an important feature for me and I'd still want to be able to do that if the card title is a link. Perhaps clicking on the link text should open the link, while clicking within the card but outside the text should open the markdown file?

@rjgibson
Copy link
Author

Alternatively, you could require a modifier key for following the link (e.g. option + click).

@brokensandals
Copy link
Owner

Released a rough version of this in 1.1.0. Currently only supports the [title](href) link syntax, and it's parsed via regex and won't handle stuff like escape characters right.

I liked the key modifier idea & went with that. It uses the javascript event metaKey property; on Mac, that corresponds to the command key. Let me know if that doesn't work on your platform.

@rjgibson
Copy link
Author

rjgibson commented Feb 6, 2021

I installed v1.1.0 and tried it out but I haven't been able to get it to follow an embedded link.

When I embed a link in a card (i.e. the second-level title in the markdown file) I can see the link icon on the card, and it shows the correct path when I hover over it, but Cmd-Click (I'm also using a Mac) doesn't follow it.

  • A regular click (no modifier) takes me to the correct location in the markdown file as expected
  • Cmd-Click behaves like a regular click on cards without links, but does nothing on cards with links
  • I also tried Opt-Click, which behaves the same as a regular click

When I embed a link in a column title (i.e. the first-level heading in the markdown file) I don't see a link icon, and hovering over it doesn't display anything. But if I edit the link while the board is open to the side, I can see that the text is being parsed as a link as I edit it.

I'm using traditional title links with relative paths. When I following the link in the markdown file (with Opt-Click) it takes me to the correct file so I know the link isn't broken. I also tried disabling all but the Mark Headboard extension in case other extensions were interfering with it. Is there anything else I can try to help debug this?

@brokensandals brokensandals reopened this Feb 6, 2021
@brokensandals
Copy link
Owner

@rjgibson OK, I think the links aren't opening for you because they're relative paths. I used VSCode's openExternal function, which is for opening URLs in the browser etc. For relative paths, am I correct to assume that you want to open the linked file in VS Code itself? I should be able to make that change pretty easily.

Regarding the link icon/hovertext not showing on first-level headings, can you test with the following file? For me, both the column and the card get the link icon and can be opened with command-click.

# [Google](http://google.com)

## [Also Google](http://google.com)

@rjgibson
Copy link
Author

rjgibson commented Feb 7, 2021

That's it: FQDN's work; relative links don't. I also see the icon/hovertext on the first-level heading now. I think I missed it before because the rendered view seems to lag, or doesn't sync, with the markdown file in that respect. If I change the markdown link, the rendered view on the Board doesn't show the update when I hover over it, despite writing out the markdown file -- I have to close the Board and reopen it. This only appears to be a problem for first-level headings, though.

Yes, I'm hoping to be able to open relative links in VS Code. The idea is to have a todo file where each second-level header is a relative link to a project file in the same workspace. That way I can click on any todo item to get more information about it.

@brokensandals
Copy link
Owner

OK, I think those issues are fixed in 1.2.0.

This probably still needs a little refinement though because the links open in the same pane as the board - so if it's a split-screen view with the board on the right, the linked file opens in a tab on the right. That doesn't seem intuitive to me, though I'm not sure what the best way for it to decide where to open it is.

@rjgibson
Copy link
Author

rjgibson commented Feb 7, 2021

Looks good, thanks!

Regarding the problem of the link opening up in the tab on the right, I see that the VS Code Window class includes an activeTextEditor variable. While I'm not familiar with the VS Code API, I wonder if there might be a way to save the active editor at the time the user runs Open as Board to the Side and then switch focus to it when following any links from the Board.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants