Coder Social home page Coder Social logo

Resolve relative paths to files about cosmere HOT 5 CLOSED

mihaeu avatar mihaeu commented on August 16, 2024 1
Resolve relative paths to files

from cosmere.

Comments (5)

mihaeu avatar mihaeu commented on August 16, 2024 1

from cosmere.

mihaeu avatar mihaeu commented on August 16, 2024

Brainstorming:

if the relative link target is in the cosmere config
   generate a link to that confluence page
else if the relative link is part of the repository
  generate a link to the repository
else
  ???
``

from cosmere.

codethief avatar codethief commented on August 16, 2024

Automatically converting links to relative paths would indeed be a very nice feature! I would give this a shot and try to come up with a patch, but so far I haven't been able to figure out where in the code links get converted. Could you give me a pointer?

else if the relative link is part of the repository
generate a link to the repository

Which repository are you referring to?

from cosmere.

mihaeu avatar mihaeu commented on August 16, 2024

Hi @codethief

So I was assuming (based on how I use it and how I've seen others use it) that people keep their markdown files in a git repository.

So case 1 would be a lookup in the cosmere.json config. Case 2 would be a lookup in the repository that contains the file itself. An example might be that you're linking to a file in your codebase, e.g. package.json or pom.xml which will be lost in Confluence. But to really make these links useful, they would have to point to the repository. So maybe <a href="https://github.com/mihaeu/cosmere/package.json">...</a>, but the question is where to get the base URL from. It could be guessed from the git remote, but that's not reliable because if it's ssh then it's hard to extrapolate the URL from that. I think it would have to be another setting in the cosmere.json. Another option would be to lookup the property from the package.json. It's already in there, but I've also seen people use cosmere from a Docker container, globally or without really installing it using npx and then there wouldn't be a package.json to refer to.

Long story short: I guess a first step would be a simple config lookup. Step two could be adding a new field to the config and printing warnings if there are relative links that cannot be resolved.

And to make things even more complicated it would be nice if anchors would be resolved properly, because afaik that's not working properly right now.

from cosmere.

codethief avatar codethief commented on August 16, 2024

Hmm I'm not sure I see the use case yet. What stops you from linking the Github URL directly in your Markdown files? I think what you're having in mind is a general way to re-write anchor links. That might definitely be useful but I think as a very first step I would focus on getting relative links (to other pages handled by Cosmere) right.

from cosmere.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.