I want visitors to know a link opens a PDF before they click it. Instead of adding a class to every link, I let an attribute selector look at the URL.
a[href$=".pdf" i]::after {
content: " (PDF)";
font-size: 0.85em;
}
a[href^="http"]:not([href*="example.com"])::after {
content: " \2197";
}
$= matches the end of the value, ^= the start and *= anywhere inside it. The i before the closing bracket makes the comparison case insensitive, so .PDF also matches. The second rule adds an arrow to absolute links that do not point to your own domain, which is an easy external link marker.
Because the markers come from the URL itself, new posts get them without anyone remembering a class.
Two caveats. A URL with a query string, like report.pdf?v=2, does not end in .pdf, so $= misses it. And generated content is read by many screen readers but not all of them in the same way, so if the file type really matters, put it in the link text instead of only in CSS.
Further reading: MDN: Attribute selectors