Skip to content

Proposal: Autolink with [code] #1663

Closed as not planned
Closed as not planned
@wojtekmach

Description

@wojtekmach

Currently we autolink expressions like `String`, `String.upcase/1`, etc. The obvious problem is auto linking "Erlang" modules, e.g.: `:file`, which we don't do, because we don't know if the user intended to link to a module or just wrote the atom :file. We can today solve this by writing [`:file`](`:file`) but it's verbose as well as when any other Markdown parser sees it, it will output garbage.

Instead of implicitly treat `code` as potential links, I'd like to propose supporting an explicit syntax: [`code`]. This is what Rust does. See erlef/build-and-packaging-wg#60 (comment). By having explicit syntax, the tooling will know the user intended to write a code reference and thus can output warnings, etc. This will have much more predictable result on non-ExDoc: GitHub, etc would render [`:file`] as [<code>:file</code>] which I think is very reasonable.

Here's a proof of concept: https://gist.github.com/ef18199a4283d9a59b9fdfb571a4e251.

Per erlef/build-and-packaging-wg#60, there are conversations about introducing another EEP that would make Markdown officially supported document format for Erlang. I think there's appetite for supporting the syntax I'm proposing there. If it would be accepted there then I think there'd be a strong reason to support it in Elixir ecosystem too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions