#1168 Tag specfile example source
Merged 2 years ago by tibbs. Opened 2 years ago by ferdnyc.
Unknown source tag-spec-source  into  master

@@ -329,7 +329,8 @@

  

  The following format must be used:

  

- ....

+ [source, rpm-spec]

+ ----

  Source0: ftp://ftp.example.com/pub/foo/%{name}-%{version}.tar.gz

  Source1: ftp://ftp.example.com/pub/foo/%{name}-%{version}.tar.gz.asc

  Source2: https://www.example.com/gpgkey-0123456789ABCDEF0123456789ABCDEF.gpg
@@ -338,7 +339,7 @@

  %prep

  %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'

- ....

+ ----

  

  The first source is the actual tarball,

  the second one is the signature from upstream,
@@ -374,7 +375,8 @@

  then the verification step must be adjusted accordingly,

  for example:

  

- ....

+ [source, rpm-spec]

+ ----

  Source0: ftp://ftp.example.com/pub/foo/%{name}-%{version}.tar.xz

  Source1: ftp://ftp.example.com/pub/foo/%{name}-%{version}.tar.asc

  Source2: https://www.example.com/gpgkey-0123456789ABCDEF0123456789ABCDEF.gpg
@@ -383,7 +385,7 @@

  %prep

  xzcat '%{SOURCE0}' | %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data=-

- ....

+ ----

  

  Packages that are vital during bootstrapping of Fedora

  may use a <<bootstrapping,bootstrap flag>>
@@ -453,11 +455,12 @@

  and the repositories to which the built noarch package will be added,

  by using either the `+ExcludeArch:+` or `+ExclusiveArch:+` tags:

  

- ....

+ [source, rpm-spec]

+ ----

  BuildArch: noarch

  # List the arches that the dependent package builds on below

  ExclusiveArch: %{ix86} %{arm} x86_64 noarch

- ....

+ ----

  

  Sometimes a language runtime you are packaging for will provide a macro

  for the arches it's available on, for instance,
@@ -474,11 +477,12 @@

  which are conditionalized on architecture.

  For example, this is forbidden:

  

- ....

+ [source, rpm-spec]

+ ----

  %ifarch ppc64

  Patch0: build-fix-for-ppc64.patch

  %endif

- ....

+ ----

  

  Conditionalizing `+Source:+` or `+Patch:+` tags by architecture

  causes the contents of the source package to differ
@@ -494,13 +498,14 @@

  using `+%ifarch+` or `+%ifnarch+` as appropriate.

  For example:

  

- ....

+ [source, rpm-spec]

+ ----

  %prep

  %setup -q

  %ifarch s390x

  %patch0 -p1

  %endif

- ....

+ ----

  

  == Filesystem Layout

  
@@ -669,10 +674,11 @@

  they work according to the path specified in the rpm `+%files+` section.

  So an rpm which specified:

  

- ....

+ [source, rpm-spec]

+ ----

  %files

  /bin/sh

- ....

+ ----

  

  would be able to satisfy a file dependency for `+/bin/sh+`

  but not for `+/usr/bin/sh+`.
@@ -690,12 +696,13 @@

  you can use a Virtual Provides to list the alternate path.

  For instance:

  

- ....

+ [source, rpm-spec]

+ ----

  Provides: %{_sbindir}/ifconfig

  [...]

  %files

  /sbin/ifconfig

- ....

+ ----

  

  If you are a packager who uses file dependencies

  to Require the proper dependencies
@@ -792,15 +799,17 @@

  to the package name.

  For example:

  

- ....

+ [source, rpm-spec]

+ ----

  Requires: foo

- ....

+ ----

  

  becomes:

  

- ....

+ [source, rpm-spec]

+ ----

  Requires: foo%{?_isa}

- ....

+ ----

  

  If the foo-devel package has a foo-config script,

  you can try doing a foo-config --libs and foo-config --cflags
@@ -897,11 +906,12 @@

  (unless the packages involved are noarch)

  and there should be a spec file comment justifying it:

  

- ....

+ [source, rpm-spec]

+ ----

  # The automatic dependency on libfubar.so.1 is insufficient,

  # as we strictly need at least the release that fixes two segfaults.

  Requires: libfubar%{?_isa} >= 0:1.2.3-7

- ....

+ ----

  

  Packagers should revisit an explicit dependency

  as appropriate to avoid it becoming inaccurate and superfluous.
@@ -937,10 +947,11 @@

  but SRPMs need to be architecture independent.

  For instance, if you did this:

  

- ....

+ [source, rpm-spec]

+ ----

  # Example of what *not* to do

  BuildRequires:  foo%{?_isa} >= 3.3

- ....

+ ----

  

  Then the SRPM that is built in Fedora would have one of these Requirements

  depending on what builder the SRPM was created on:
@@ -1091,28 +1102,36 @@

  If a particular change is related to a Bugzilla bug,

  include the bug ID in the changelog entry for easy reference, e.g.

  

- ....

+ [source, rpm-spec]

+ ----

+ %changelog

  * Wed Jun 14 2003 Joe Packager <joe at gmail.com> - 1.0-2

  - Added README file (#42).

- ....

+ ----

  

  You must use one of the following formats:

  

- ....

+ [source, rpm-spec]

+ ----

+ %changelog

  * Fri Jun 23 2006 Jesse Keating <jkeating@redhat.com> - 0.6-4

  - And fix the link syntax.

- ....

+ ----

  

- ....

+ [source, rpm-spec]

+ ----

+ %changelog

  * Fri Jun 23 2006 Jesse Keating <jkeating@redhat.com> 0.6-4

  - And fix the link syntax.

- ....

+ ----

  

- ....

+ [source, rpm-spec]

+ ----

+ %changelog

  * Fri Jun 23 2006 Jesse Keating <jkeating@redhat.com>

  - 0.6-4

  - And fix the link syntax.

- ....

+ ----

  

  Changelog entries should provide a brief summary

  of the changes done to the package between releases,
@@ -1139,21 +1158,25 @@

  In this situation, you have added this changelog entry,

  but have not built the package yet:

  

- ....

+ [source, rpm-spec]

+ ----

+ %changelog

  * Nov 12 2010 Toshio Kuratomi <toshio_fedoraproject.org> - 1.0-1

  - Fix spelling errors in package description

- ....

+ ----

  

  The next day, you make additional changes to the spec,

  and need to add a new changelog line,

  then you would update the existing date line for 1.0-1,

  and append any new notes, making the changelog look like this:

  

- ....

+ [source, rpm-spec]

+ ----

+ %changelog

  * Nov 13 2010 Toshio Kuratomi <toshio_fedoraproject.org> - 1.0-1

  - Fix spelling errors in package description

  - Add a patch to fix compilation problems on F15

- ....

+ ----

  

  Please remember that this is only acceptable if 1.0-1 has not yet been built.

  
@@ -1168,23 +1191,27 @@

  In this situation, you have added this changelog entry,

  but have not built the package yet:

  

- ....

+ [source, rpm-spec]

+ ----

+ %changelog

  * Nov 12 2010 Toshio Kuratomi <toshio_fedoraproject.org> - 1.0-1

  - Fix spelling errors in package description

- ....

+ ----

  

  The next day, you make additional changes to the spec,

  and need to add a new changelog line.

  Now, you can add an additional changelog item with the new date,

  but the same Version-Release, so your new changelog looks like this:

  

- ....

+ [source, rpm-spec]

+ ----

+ %changelog

  * Nov 13 2010 Toshio Kuratomi <toshio_fedoraproject.org> - 1.0-1

  - Add a patch to fix compilation problems on F15

  

  * Nov 12 2010 Toshio Kuratomi <toshio_fedoraproject.org> - 1.0-1

  - Fix spelling errors in package description

- ....

+ ----

  

  Please remember that this is only acceptable if 1.0-1 has not yet been built.

  
@@ -1207,10 +1234,11 @@

  So the `+%files+` section MUST reference manpages

  with a pattern that takes this into account:

  

- ....

+ [source, rpm-spec]

+ ----

  %files

  %{_mandir}/man1/foo.1*

- ....

+ ----

  

  Note also that files installed in `+%{_mandir}+`

  are automatically marked by RPM as documentation.
@@ -1244,9 +1272,10 @@

  If clang is being used to build a package,

  packagers must set the %toolchain macro to clang:

  

- ....

+ [source, rpm-spec]

+ ----

  %global toolchain clang

- ....

+ ----

  

  This ensures that Fedora's clang-specific compiler flags are used

  when compiling.
@@ -1255,10 +1284,11 @@

  to make it easier to switch between two different compilers,

  then the following macros names should be used:

  

- ....

+ [source, rpm-spec]

+ ----

  %bcond_with toolchain_clang

  %bcond_with toolchain_gcc

- ....

+ ----

  

  Packagers may also use the %build_cc, %build_cxx, or %build_cpp macros

  in the spec file in place of hard-coding the compiler name.
@@ -1305,9 +1335,10 @@

  In Fedora, PIE is enabled by default. To disable it in your

  spec, add:

  

- ....

+ [source, rpm-spec]

+ ----

  %undefine _hardened_build

- ....

+ ----

  

  If your package meets any of the following criteria you

  MUST NOT disable the PIE compiler flags:
@@ -1438,9 +1469,10 @@

  it must do so using a fully versioned arch-specific

  (for non-noarch packages) dependency:

  

- ....

+ [source, rpm-spec]

+ ----

  Requires: %{name}%{?_isa} = %{version}-%{release}

- ....

+ ----

  

  == Shared Libraries

  
@@ -1576,11 +1608,12 @@

  you MAY place all the static library files in the _*-devel_ subpackage.

  When doing this you also MUST have a virtual Provide

  for the _*-static_ package:

- 

- ....

+ +

+ [source, rpm-spec]

+ ----

  %package devel

  Provides: foo-static = %{version}-%{release}

- ....

+ ----

  

  Packages which explicitly need to link against the static version

  MUST `+BuildRequire: foo-static+`,
@@ -1602,10 +1635,11 @@

  Place all of the header files in the _*-devel_ subpackage

  and then you must have a virtual Provide for the _*-static_ package:

  

- ....

+ [source, rpm-spec]

+ ----

  %package devel

  Provides: foo-static = %{version}-%{release}

- ....

+ ----

  

  Packages which use the header library must `+BuildRequire: foo-static+`,

  so that the usage can be tracked.
@@ -1718,11 +1752,12 @@

  It is a good idea to add it to the `+%__arch_install_post+` macro

  in your `+~/.rpmmacros+` config file:

  

- ....

- %__arch_install_post            \

+ [source, rpm-spec]

+ ----

+ %__arch_install_post          \

  /usr/lib/rpm/check-rpaths     \

  /usr/lib/rpm/check-buildroot

- ....

+ ----

  

  When _check-rpaths_ is run, you might see output like this:

  
@@ -1792,11 +1827,12 @@

  * If the application uses a local copy of libtool,

  add the following lines to the spec after %configure:

  

- ....

+ [source, rpm-spec]

+ ----

  %configure

  sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool

  sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

- ....

+ ----

  

  * Sometimes, the code/Makefiles can be patched

  to remove the _-rpath_ or _-R_ flag from being called.
@@ -1928,23 +1964,26 @@

  if the .desktop file's content/location does not need modification.

  Here are some examples of usage:

  

- ....

+ [source, rpm-spec]

+ ----

  desktop-file-install                                    \

  --dir=%{buildroot}%{_datadir}/applications              \

  %{SOURCE3}

- ....

+ ----

  

- ....

+ [source, rpm-spec]

+ ----

  desktop-file-install                                    \

  --add-category="AudioVideo"                             \

  --delete-original                                       \

  --dir=%{buildroot}%{_datadir}/applications              \

  %{buildroot}/%{_datadir}/applications/foo.desktop

- ....

+ ----

  

- ....

+ [source, rpm-spec]

+ ----

  desktop-file-validate %{buildroot}/%{_datadir}/applications/foo.desktop

- ....

+ ----

  

  Do *not* apply a vendor tag to .desktop files (using --vendor).

  
@@ -2158,16 +2197,18 @@

  

  If the package uses gettext for translations, add

  

- ....

+ [source, rpm-spec]

+ ----

  BuildRequires: gettext

- ....

+ ----

  

  For Qt-based packages that use the Linguist tool chain,

  for the localization utilities add

  

- ....

+ [source, rpm-spec]

+ ----

  BuildRequires: qt-devel

- ....

+ ----

  

  If you have few enough locale files that they can all go into one package,

  you can use the `+%find_lang+` macro.
@@ -2180,9 +2221,10 @@

  after all of the files have been installed into the buildroot.

  The correct syntax for `+%find_lang+` is usually:

  

- ....

+ [source, rpm-spec]

+ ----

  %find_lang %{name}

- ....

+ ----

  

  In some cases, the application may use a different "name" for its locales.

  You may have to look at the locale files and see what they are named.
@@ -2198,39 +2240,44 @@

  to include the locales detected by `+%find_lang+`.

  To do this, you should include it with the -f parameter to `+%files+`.

  

- ....

+ [source, rpm-spec]

+ ----

  %files -f %{name}.lang

  %{_bindir}/foobar

  ...

- ....

+ ----

  

  Note that `+%find_lang+` by default searches for gettext locales,

  but it can also handle Qt translations, localised manpages and help files.

  

  To process GNOME help files put into `+/usr/share/gnome/help/+` use

  

- ....

+ [source, rpm-spec]

+ ----

  %find_lang %{name} --with-gnome

- ....

+ ----

  

  To process KDE help files put into `+/usr/share/doc/HTML/+` use

  

- ....

+ [source, rpm-spec]

+ ----

  %find_lang %{name} --with-kde

- ....

+ ----

  

  To process Qt's `+.qm+` binary translation files use

  

- ....

+ [source, rpm-spec]

+ ----

  %find_lang %{name} --with-qt

- ....

+ ----

  

  To process localised manpages

  (doesn't include the default, non-localised one), use

  

- ....

+ [source, rpm-spec]

+ ----

  %find_lang %{name} --with-man

- ....

+ ----

  

  To see all the options, run `+/usr/lib/rpm/find-lang.sh+` in the terminal.

  
@@ -2241,7 +2288,8 @@

  in `+foo.spec+` with the "foo" application localised

  using gettext and man pages named "bar" instead of "foo":

  

- ....

+ [source, rpm-spec]

+ ----

  Name: foo

  ...

  %prep
@@ -2268,7 +2316,7 @@

  

  * Thu May 4 2006 Tom "spot" Callaway <tcallawa@redhat.com> 0.1-1

  - sample spec that uses %%find_lang

- ....

+ ----

  

  === Why do we need to use %find_lang?

  
@@ -2280,14 +2328,15 @@

  * Most packages that have locales have lots of locales.

  Using `+%find_lang+` is much easier in the spec file than having to do:

  

- ....

+ [source, rpm-spec]

+ ----

  %{_datadir}/locale/ar/LC_MESSAGES/%{name}.mo

  %{_datadir}/locale/be/LC_MESSAGES/%{name}.mo

  %{_datadir}/locale/cs/LC_MESSAGES/%{name}.mo

  %{_datadir}/locale/de/LC_MESSAGES/%{name}.mo

  %{_datadir}/locale/es/LC_MESSAGES/%{name}.mo

  ...

- ....

+ ----

  

  * As new locale files appear in later package revisions,

  `+%find_lang+` will automatically include them when it is run,
@@ -2346,9 +2395,10 @@

  

  Whenever possible, invocations of `+make+` should be done as

  

- ....

+ [source, rpm-spec]

+ ----

  %make_build

- ....

+ ----

  

  This generally speeds up builds and especially on SMP machines.

  
@@ -2356,9 +2406,10 @@

  as some make files do not support parallel building.

  Therefore you should consider adding

  

- ....

+ [source, rpm-spec]

+ ----

  %_smp_mflags -j3

- ....

+ ----

  

  to your `+~/.rpmmacros+` file -- even on UP machines --

  as this will expose most of these errors.
@@ -2660,20 +2711,22 @@

  and include a link to that in the comment above the patch.

  For example:

  

- ....

+ [source, rpm-spec]

+ ----

  # https://bugzilla.gnome.org/show_bug.cgi?id=12345

  Patch: gnome-panel-fix-frobnicator.patch

- ....

+ ----

  

  The above is perfectly acceptable;

  but if you prefer,

  a brief comment about what the patch does above can be helpful:

  

- ....

+ [source, rpm-spec]

+ ----

  # Don't crash with frobnicator applet

  # https://bugzilla.gnome.org/show_bug.cgi?id=12345

  Patch: gnome-panel-fix-frobnicator.patch

- ....

+ ----

  

  Sending patches upstream and adding this comment

  will help ensure that Fedora is acting as a good FLOSS citizen
@@ -2685,24 +2738,27 @@

  

  You can indicate that you have sent the patch upstream and any known status:

  

- ....

+ [source, rpm-spec]

+ ----

  # Sent upstream via email 20080407

  Patch: foobar-fix-the-bar.patch

- ....

+ ----

  

- ....

+ [source, rpm-spec]

+ ----

  # Upstream has applied this in SVN trunk

  Patch: foobar-fix-the-baz.patch

- ....

+ ----

  

  ==== Fedora-specific (or rejected upstream) patches

  

  It may be that some patches truly are Fedora-specific; in that case, say so:

  

- ....

+ [source, rpm-spec]

+ ----

  # This patch is temporary until we land the long term System.loadLibrary fix in OpenJDK

  Patch: jna-jni-path.patch

- ....

+ ----

  

  === Applying Patches

  
@@ -2750,11 +2806,12 @@

  

  Example:

  

- ....

+ [source, rpm-spec]

+ ----

  Version: 1.2

  Release: 3%{?dist}

  Epoch: 1

- ....

+ ----

  

  A package with those definitions would be considered greater than

  a package with a higher version or a higher release.
@@ -2770,9 +2827,10 @@

  For example, if a package being depended upon has an Epoch,

  this must be listed when adding a versioned dependency:

  

- ....

+ [source, rpm-spec]

+ ----

  Requires: foo = %{epoch}:%{version}-%{release}

- ....

+ ----

  

  === Epochs from Third Party Repositories

  
@@ -2851,17 +2909,19 @@

  into %\{_sysctldir} (/usr/lib/sysctl.d/)

  you must invoke %sysctl_apply in your %post section:

  

- ....

+ [source, rpm-spec]

+ ----

  %sysctl_apply foobar.conf

- ....

+ ----

  

  If you install a binfmt configuration snippet waldo.conf

  into %\{_binfmtdir} (/usr/lib/binfmt.d/)

  you must invoke %binfmt_apply in your %post section:

  

- ....

+ [source, rpm-spec]

+ ----

  %binfmt_apply waldo.conf

- ....

+ ----

  

  These have the effect of making the appropriate changes

  immediately upon package installation
@@ -2887,10 +2947,11 @@

  that are commonly found in version upgrade changes),

  provide clean upgrade paths and compatibility with:

  

- ....

+ [source, rpm-spec]

+ ----

  Provides: oldpackagename = $provEVR

  Obsoletes: oldpackagename < $obsEVR

- ....

+ ----

  

  $provEVR refers to an (Epoch-)Version-Release tuple

  the original unchanged package would have had
@@ -2934,10 +2995,11 @@

  The following should be added to bar

  (and similarly for all subpackages as applicable):

  

- ....

+ [source, rpm-spec]

+ ----

  Provides: foo = 2:%{version}-%{release}

  Obsoletes: foo <= 2:1.0-4   # Important: We set the Obsoletes release to 4 to be higher than the previous Release: 3%{?dist}

- ....

+ ----

  

  Explicit `+Provides:+` need to be aware of whether

  the package is supplying things that can be used in an arch-independent
@@ -3035,7 +3097,8 @@

  If your package introduces build time circular dependencies,

  you should use this macro to bootstrap your package:

  

- ....

+ [source, rpm-spec]

+ ----

  # When we are bootstrapping, we drop some dependencies, and/or build time tests.

  %bcond_with bootstrap

  
@@ -3052,7 +3115,7 @@

  %check

  make check

  %endif

- ....

+ ----

  

  TIP: Since Fedora 30,

       as a nice side-effect,
@@ -3073,11 +3136,12 @@

  that is missing when bootstrapped,

  then that `+Provides:+` should look like:

  

- ....

+ [source, rpm-spec]

+ ----

  %if %{without bootstrap}

  Provides: bar(some_functionality)

  %endif

- ....

+ ----

  

  Please note that usage of pre-built binaries

  in bootstrap still needs an exception from the Packaging Committee
@@ -3144,11 +3208,12 @@

  simply by defining the corresponding variable to `+%{nil}+`.

  For example, to disable the brp-python-bytecompile script:

  

- ....

+ [source, rpm-spec]

+ ----

  # Turn off Python bytecode compilation because this is a Jython

  # package and we will generate JVM bytecode instead

  %global __brp_python_bytecompile %{nil}

- ....

+ ----

  

  Any package that disables a BRP script this way MUST also note the reason

  in an accompanying comment.

@darknao has kindly enabled specfile syntax-highlighting in staging, but to see its effects we need some code blocks tagged as containing specfile source code.

This PR enables syntax-highlighting of .spec file snippets in the main packaging-guidelines document by tagging 50 example specfile source blocks as code in the rpm-spec language.

(It also...):

  • adds the %changelog marker at the start of all of the example changelog entries, to give the highlighting parser a fighting chance
  • makes one block of example source a child element of the <ol> list item it follows, for proper indenting

This should be safe to apply, and simply have no immediate effect, in the production environment. Code blocks tagged with an unrecognized highlighting format will simply be displayed un-highlighted, same as if they were untagged.

I've no problem merging this, but it seems to have conflicts. Not sure how that happened as the repository hasn't changed recently, but in any case, did you want to fix them up?

@tibbs Huh! Strange. Perhaps I based the branch off my fork, instead of the upstream. I'll sort it out.

Edit: Heh. Yup, the commit prior to mine in the branch history is from 2019. Whoops!

rebased onto 0d72dd5

2 years ago

@tibbs Should be sorted out now.

Package Maintainer Docs also have something like that already:
Packaging Tutorial line 370

it was copied over from Quick Docs when the packaging tutorial was moved.
Seems to use slightly different syntax, however.
I do not know if it has ever worked.

@oturpe Thanks for pointing that out! That would serve as an effective test; the highlighting wouldn't have worked in production, up to this point, because highlight.js requires a plugin to support .spec file highlighting.

I did check that page on the staging server, and highlighting of the tagged block is still not succeeding — the console reports:

Falling back to no-highlight mode for this block.
Could not find the language 'RPMSpec', did you forget to load/include a language module?

That's either because the language tags @darknao set up for spec files don't include RPMSpec — they're apparently configurable, and I forgot to ask which tag name(s) the staging instance has enabled — or because the plugin isn't being loaded at all. (I'm actually sort of leaning towards the latter, as I don't see any signs of it in the page source on the staging server.)

Regardless, that existing doc means I don't have to wait for this to be merged, to start the process of figuring out with @darknao why highlighting isn't showing up on staging. So I'll update fedora-docs-ui #53 using that page as our first test, and we can start chasing down whatever needs to be corrected to get specfile syntax highlighting switched on.

(That page also shows that unknown source-language tags are indeed simply ignored, demonstrating that this PR is safe to merge prior to support being enabled in production. I mean... I know I said that it was, but even I'd be hesitant to just take my word on that! :wink: )

I'm going to merge this but for those like me who aren't experts at asciidoc, it would be nice to know why all of the instances of four dots were changed to four dashes. Basically if you have any syntax hints for us to get this right in the future, please let us know.

Pull-Request has been merged by tibbs

2 years ago

@tibbs AsciiDoc's block syntax is expansive and complex — there are actually 27 different block contexts built in, and several of them have unique shorthand delimiters. But just to be confusing, a block with any delimiters can "masquerade" as another type by making an explicit declaration of its type.

The basic block syntax is an "open block", uses two-dash fencing, and will apply no special formatting to the contents unless it's annotated with a context.

--
Nothing special about this block.
--

Four-dots fencing:

  • is shorthand for a literal block
  • is equivalent to
[literal]
--
Block contents
--
  • wraps the contents in <pre>...</pre>
  • doesn't perform syntax-highlighting

Four dashes:

  • is shorthand for a "listing" block
  • is equivalent to
[listing]
--
Block contents
--
  • can be promoted to a source block by using [source] as the annotation instead of [listing]
  • (with [source])
    • wraps the contents in <pre><code>...</code></pre>
    • accepts an optional language attribute
    • will enable syntax highlighting by setting the lang= attribute of the code tag, if either:
      • a language is directly specified for the block
      • the document has a source-language attribute, which sets a document-wide default

There are also shorthand fencings for comment blocks (////), example blocks (====), sidebar blocks (****), passthrough blocks (++++), and quote blocks (____).

Most of those just apply a particular styling to the contents, but the passthrough and comment blocks are special. Comment blocks are omitted from the rendered output entirely, their contents are only present in the source file. Passthrough blocks, OTOH, go directly into the output document with no processing, so they can be used to embed raw HTML.

Thanks for the explanation. It occurs to me that we could use a short style guide for packaging guidelines pages, but I wouldn't really know where to start, and this PR definitely isn't the right place to talk about it.

It occurs to me that we could use a short style guide for packaging guidelines pages, but I wouldn't really know where to start, and this PR definitely isn't the right place to talk about it.

Agreed on both counts. (He says, and then proceeds to talk about it anyway.)

Just as one general change/adjustment, it strikes me that the current docs are probably overreliant on .... fencing — all of those blocks could be ---- instead, even the ones that aren't necessarily source code.

(Without a [source] context annotation, ---- will end up being styled the same as ...., so it hardly seems like it would matter, but semantically it's a bit more accurate. Even program output and etc. is still a "listing" more than it is a "literal". And then those blocks are then more readily converted to possibly-highlighted source blocks by simply adding a [source] context ahead of them. Or, to put it another way around, since they're styled the same there doesn't seem to be any reason to use .... for some blocks, when ---- will work for all of them.)

Metadata