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: add option to ignore relative links #105

Closed
fricklerhandwerk opened this issue Aug 26, 2022 · 0 comments
Closed

Feature request: add option to ignore relative links #105

fricklerhandwerk opened this issue Aug 26, 2022 · 0 comments

Comments

@fricklerhandwerk
Copy link

Problem description

Relative links are useless for man and terminal representations, rendering them is very distracting.
But disabling links also disables web links.

Proposal

Add an option to only render web link URLs while keeping relative links highlighted.

Background

The Nix package manager uses lowdown to render man and --help pages.

The manual also renders as a web page and uses relative links for navigation (example). It also contains web links (example).

Currently there is no straightforward way to render the manual both for web and terminal without losing information or introducing a lot of noise on the terminal: either turn off links, then weblinks are gone, or turn on links, then the useless relative links to markdown files pollute every page.

Broken example when links enabled:

Synopsis
       nix [option…] subcommand

       where subcommand is one of the following:

       Main commands:

       • nix build (./nix3-build.md) - build a derivation or fetch a store path
       • nix develop (./nix3-develop.md) - run a bash  shell  that  provides  the
         build environment of a derivation

How it should be:

Synopsis
       nix [option…] subcommand

       where subcommand is one of the following:

       Main commands:

       • nix build - build a derivation or fetch a store path
       • nix develop - run a bash  shell  that  provides  the
         build environment of a derivation

Broken example when links disabled:

Description

    Nix is a tool for building software, configurations and other artifacts in a
    reproducible and declarative way. For more information, see the Nix homepage
    or the Nix manual.

How it should be:

Description

    Nix is a tool for building software, configurations and other artifacts in a
    reproducible and declarative way. For more information, see the Nix homepage
    (https://nixos.org/) or the Nix manual (https://nixos.org/manual/nix/stable/).

More background

It appears @edolstra decided to use lowdown because it has no dependencies and does the job. I think it does a great job, as it allows the project to manage documentation in a uniform, easily accessible format and make it available in different contexts. Thank you for this tool, it's really well documented and easy to use.

The Nix ecosystem has a reputation of terrible documentation, and I work on improving it. Since all the different representations go through one build process, I got stuck with this problem while trying to clean it up. The goal of my refactoring attempt was easing maintenance of documentation, making it more accessible even to occasional contributors.

I tried working around the issue within the build setup, but it already is a tangled mess. It appears easier and more sustainable to add a feature to lowdown than manually fighting such a recurring pattern, which a markdown processor is much more suitable to deal with.

fricklerhandwerk added a commit to fricklerhandwerk/nix that referenced this issue Aug 26, 2022
this simplifies the setup a lot, and avoids weird looking `./file.md`
links showing up.

it also does not show regular URLs any more. currently the command
reference only has few of them, and not showing them in the offline
documentation is hopefully not a big deal.

instead of building more special-case solutions, clumsily preprocessing
the input, or issuing verbal rules on dealing with URLs, should better
be solved sustainably by not rendering relative links in `lowdown`:

kristapsdz/lowdown#105
fricklerhandwerk added a commit to fricklerhandwerk/nix that referenced this issue Aug 26, 2022
this simplifies the setup a lot, and avoids weird looking `./file.md`
links showing up.

it also does not show regular URLs any more. currently the command
reference only has few of them, and not showing them in the offline
documentation is hopefully not a big deal.

instead of building more special-case solutions, clumsily preprocessing
the input, or issuing verbal rules on dealing with URLs, should better
be solved sustainably by not rendering relative links in `lowdown`:

kristapsdz/lowdown#105
Minion3665 pushed a commit to Minion3665/nix that referenced this issue Feb 23, 2023
this simplifies the setup a lot, and avoids weird looking `./file.md`
links showing up.

it also does not show regular URLs any more. currently the command
reference only has few of them, and not showing them in the offline
documentation is hopefully not a big deal.

instead of building more special-case solutions, clumsily preprocessing
the input, or issuing verbal rules on dealing with URLs, should better
be solved sustainably by not rendering relative links in `lowdown`:

kristapsdz/lowdown#105
kristapsdz added a commit that referenced this issue Dec 22, 2024
This makes sense for -tterm because, while it can display actual
links, there's no concept of a current location for relative links.

References #105
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

1 participant