-
Notifications
You must be signed in to change notification settings - Fork 355
Should support opening relative links to markdown #85
Comments
Yes, support for working links would be awesome. Especially when testing your markdown-file, so see whether internal and external document links work correctly. +1 |
+1 |
1 similar comment
+1 |
+1 |
2 similar comments
+1 |
+1 |
+1! |
+1 |
2 similar comments
+1 |
+1 |
+1 |
+1 |
1 similar comment
+1 |
+1 feels like this should be relatively easy, pun intended. Might have a look into it. |
+1 |
1 similar comment
+1 |
|
+1 |
1 similar comment
👍 |
I poked around in this some, and got it working by adding the following snippet to the attached() method in markdown-preview-view.coffee. document.getElementsByClassName('markdown-preview')[0].addEventListener 'click', (event) =>
if event.target.tagName == 'A' && event.target.protocol == 'file:'
atom.workspace.open event.target.getAttribute('href'), { split: 'left' } Seeing as this is my first attempt at coffeescript and editing Atom plugins, I'm probably doing all sorts of things wrong.
If someone with more knowledge of coffeescript and plugin API would like to clean this up into a proper pull request, or if you just want to test it out yourself, my fork is here: https://github.com/rscottfree/markdown-preview |
It would be great if the path was checked and if the file doesn't exist then Atom would offer to create a new file. Otherwise the file would open as normal if it does exist. For an example of this check out MacDown. |
+1 |
1 similar comment
+1 |
+1 👍 |
+1 |
+10000 |
@rscottfree, thanks for the lead! Your modification works well for me except when I have multiple project folders open—in that case, clicking on the relative link attempts to open the file in the path of the project folder I opened first (which may or may not be the folder that the relative link is supposed to point at!) I modified ~/.atom/packages/markdown-preview-plus/lib/markdown-preview-view.coffee, reloaded Atom with # attempting to get relative links in markdown preview to open when clicked!
document.getElementsByClassName('markdown-preview')[0].addEventListener 'click', (event) =>
if event.target.tagName == 'A' && event.target.protocol == 'file:'
activeFile = @getPath()
activeFileDir = path.dirname(activeFile)
clickedFile = event.target.getAttribute('href')
clickedPath = path.join(activeFileDir, clickedFile)
atom.workspace.open clickedPath, { split: 'left' } Thanks again! |
What about a PR? 😺 |
@bojidar-bg, fair point. I don't actually know Javascript, but I'll prepare a patch for testing and submit a PR if it looks good :) |
I submitted a PR for this feature here: #442 |
+1 |
Reminder that you can now +1 on the topic itself so that it doesn't send On Tue, Oct 18, 2016 at 5:51 PM, Adam Brown [email protected]
|
Now that Github Pages supports relative links, Atom is the last hold out. https://github.com/blog/2289-publishing-with-github-pages-now-as-easy-as-1-2-3 |
Also it would be great if the clicked link would not open in new tab but in the same tab as current page. Sort of static web pages... |
Not sure, I think it would be better if the last one is configurable (I don't want it navigating around if I misclick). |
Well, the option for user to choose the behaviour is definitely the best variant :). |
+1 |
Still no update on this? I'm really frustrated now that I can't even test the links... |
Thank you... I would really like to help fix this. Anyone want to get
together for a hackathon to solve some of the lingering markdown problems?
…On Thu, Feb 23, 2017 at 5:37 PM, rlam3 ***@***.***> wrote:
Still no update on this? I'm really frustrated now that I can't even test
the links...
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#85 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKN8wYsTGHKX1qbVoE_kuAfApacPed8aks5rfjQ8gaJpZM4B9Fv_>
.
|
I would love to help, but I’m not knowledgeable enough on the coding. I’m happy to contribute bounty $.
|
@braderhart @tucknology No need anymore. Somebody else already did it. https://atom.io/packages/markdown-preview-enhanced I'm uninstalling markdown-preview-plus to get it to work smoothly. It has much more functionality as well. |
Happy to merge the work but we need a native solution.
…On Thu, Feb 23, 2017 at 5:45 PM, rlam3 ***@***.***> wrote:
@braderhart <https://github.com/braderhart> @tucknology
<https://github.com/tucknology> No need anymore. Somebody else already
did it.
Just need to install this package...
https://atom.io/packages/markdown-preview-enhanced
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#85 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKN8wbOoo6_2fs7fZvUZBi_qNXAmkWwiks5rfjZKgaJpZM4B9Fv_>
.
|
+1 |
Hi, this development is still stuck? Last comment is from March 2017. Thanks! |
@alexmorosmarco (and future intrepid googlers), check out https://github.com/shd101wyy/markdown-preview-enhanced It's alright. |
On January 30, 2013 relative links in markup files was added to github, https://github.com/blog/1395-relative-links-in-markup-files
Clicking on
[a relative link](other_file.md)
does not work.Env
markdown-preview 0.71.0 in Atom 0.96.0 on Mac OS X 10.9.2.
Actual Result
No action.
Expected Result
A new preview tab with the linked md file.
Additional Details
Github Pages now supports relative links, as documented December 5, 2016 https://github.com/blog/2290-relative-links-for-github-pages
The text was updated successfully, but these errors were encountered: