Skip to content

[sysmda_md_actions] — copy, view, download

A GitHub-style split button for readers. The main action copies the complete Markdown document to the clipboard; the dropdown repeats copy and adds view in a new tab and download.

[sysmda_md_actions]
[sysmda_md_actions id="123"]
AttributeDefaultMeaning
idcurrent postThe post the actions apply to

The whole document as it is served — front matter, title and body — fetched from the .md URL at the moment of the click, so it is never a stale copy of what was on the page.

If the response does not come back as text/markdown, the copy is refused rather than pasting whatever arrived. That matters on hosts where a cache might answer with the HTML page: better an action that fails visibly than a reader who thinks they copied Markdown and pasted a page of markup.

The stylesheet and script load only on pages where this shortcode actually renders. A site that uses it on ten articles pays for it on those ten, and nowhere else — no theme-wide asset, no request on pages that do not use it.

This works whether the shortcode sits in the post content, in a template, in a widget or in a secondary loop.

The menu is moved to the end of the document when it opens and positioned against the button: aligned to its left edge, dropping straight below it. Only when the screen edge leaves no room does it align to the right edge instead, flip above the button, or shrink and scroll — and it always stays clear of the screen edges.

This is not decoration. A dropdown rendered inside a narrow article column gets clipped by the theme’s overflow rules, and on a phone it is the difference between a working menu and one you cannot see. Positioning it against the viewport removes the theme from the equation.

Minimal white-and-bordered by default, with namespaced classes so a theme can restyle it. There is no settings UI for the appearance and no filters for the items or labels — the actions are fixed at three, and the scope is fixed on purpose.

An earlier version of this plugin shipped a configurable, automatically-inserted Markdown button. It broke layouts on mobile, loaded assets for every visitor including the majority who never used it, and each round of feedback bought another round of CSS fighting an unknown theme. It was removed. This shortcode is the narrow version that survived: explicit placement, three actions, assets only where used.

If you want something else entirely, [sysmda_md_url] gives you the URL and your theme does the rest.

Copying to the clipboard requires JavaScript and a secure context (HTTPS). On a site served over plain HTTP the copy action will not work — the view and download actions still will.

If the post has no Markdown version, the shortcode outputs nothing at all, and no assets are loaded for it.