pa module (v0.2.x)
pa exposes page-level helpers.
import { pa } from "@page-proxy/pp";
notification(...values)
Shows an in-page notification and logs values to the console.
Notification behavior:
- Rich object/element viewer
- Close button support
- Auto-dismiss after ~4.2s
- Auto-dismiss pauses while any details viewer is open
- Keeps at most 4 notifications on screen
pa.notification("User synced", { id: "u_42", plan: "pro" });
pa.notification("Primary button", document.querySelector(".btn-primary"));
renderMarkdown(content, options)
Renders markdown to sanitized HTML.
Options:
breaks?: boolean(defaulttrue): Controls line-break handling while parsing markdown. Whentrue, single newlines become<br>; whenfalse, markdown uses stricter paragraph rules.linkTarget?: string(default"_blank"): Applied to every rendered<a href="...">as itstargetattribute. Use"_self"to open links in the current tab.linkRel?: string(default"noreferrer noopener"): Applied to every rendered link as itsrelattribute. This is useful for security when links open in a new tab.linkReferrerPolicy?: string(default"no-referrer"): Applied to every rendered link asreferrerpolicy, controlling whether browser referrer information is sent on navigation.
const html = pa.renderMarkdown("See [docs](https://orangishcat.github.io/page-proxy/docs)");
document.querySelector("#help")?.insertAdjacentHTML("beforeend", html);
moveNode(node, position = -1, parent = node.parentElement)
Moves node to the positionth child of parent.
- If
positionis greater than child count, node is moved to the end. - If
positionis below0, it is treated aspositionplaces from the end (-1is last,-2is second last).
const list = document.querySelector(".todo-list");
const item = list?.querySelector(".todo-item");
if (list && item) {
pa.moveNode(item, 0, list); // move to first child
pa.moveNode(item, -1, list); // move to last child
}