website/gems/lib/asciidoctor/swhid-inline-macro
2023-05-06 15:22:27 +08:00
..
extension.rb Add full options attribute for SWHID inline macro 2023-05-06 15:22:27 +08:00
README.adoc Add full options attribute for SWHID inline macro 2023-05-06 15:22:27 +08:00

An inline macro for easily linking SWHIDs.

Synopsis

swh:$SWHID[$CAPTION]

If no caption is given, the link text will be the core identifier of the SWHID.

Attributes

You can configure certain behavior of the macro with the options attribute. Heres a list of them…

  • full will make the entire SWHID as the default link text.

Extra notes

You would use like in the following form swh:swh:1:snp:6ea7d28dfd4789609e0be2b64179fc9c12931beb[] but you could also cut off swh: from the SWHID if you want to (i.e., swh:1:snp:6ea7d28dfd4789609e0be2b64179fc9c12931beb[]) to make it aesthetically pleasing.

Whatever your preference is, the best practice for dealing with linking SWHIDs with this macro is setting attributes containing the SWHIDs.

= doctitle
:swhid-nixpkgs: swh:1:dir:2885ecf76632a83610d8e95f0eb3383109a7c90a

{swhid-nixpkgs}[this revision of nixpkgs]
or
swh:{swhid-nixpkgs}[that revision of nixpkgs]

Example usage

This should work with the following types of SWHIDs.

  • A SWHID with only the core identifier: swh:1:snp:6ea7d28dfd4789609e0be2b64179fc9c12931beb[].

  • A SWHID with only one qualifier with a link caption: swh:1:cnt:ce4dd1988d2d5dfcec48252757a6fea94339ac38;lines=3-4[some code text]

  • A SWHID with full contextual information. This is as depicted from the recommended practice for writings (i.e., blog posts, technical documentation, research papers) when referring to one of the objects in the archive.

    swh:1:dir:2885ecf76632a83610d8e95f0eb3383109a7c90a;origin=https://github.com/NixOS/nixpkgs;visit=swh:1:snp:6ea7d28dfd4789609e0be2b64179fc9c12931beb;anchor=swh:1:rev:b7ee21d0ced814d07b7d5aca334dfe018ceafaa5[]