I have my post folders in a folder. Each folder contains a pdf file and an index.md with the frontmatter and just the link as follows: Click here to access the pdf. I would like to set a class to the “Click here to access the pdf” text so it would englobe all posts and add some CSS love to that text.
I have seen a few posts saying the only way to go is a shortcode but I am not sure to understand the underlying logic of it and if it applies to my case. Also these posts were all from at least 3-4 years ago.
just to get the point for me: Why cant you just using the a selector in your sass/css?
if you want to add classes to the HTML a tag, you will have to either:
shortcode in Markdown
customize the build in shortcode (ref) or create your own (maybe (refPdf) (Shortcode templates)
custom link render hook
copy the code and add your class for that specific stuff see (Link render hooks)
the shortcode is easier, as you can have one exactly for these PDFs - if you want to style ALL markodwn links, than the Render Hook would be a good choice.
You could also:
enable inline HTML for markdown
(Configure markup) renderer.unsafe
(bool) If true, Goldmark renders raw HTML mixed within the Markdown. This is unsafe unless the content is under your control. Default is false.