/** * Replaces double asterisks with `` tags. * * @param {string} text * @returns {string} */ export function transformStrong(text) { // Keep track of whether we're inside a tag. let startingTag = false; return text.replaceAll('**', () => { // Reverse the starting tag state to determine the current state. startingTag = !startingTag; // Return the appropriate tag. return startingTag ? '' : ''; }); } /** * Replaces double asterisks with `` tags. * * @param {string} text * @returns {string} */ export function transformEmphasis(text) { // Keep track of whether we're inside an tag. let startingTag = false; return text.replaceAll('**', () => { // Reverse the starting tag state to determine the current state. startingTag = !startingTag; // Return the appropriate tag. return startingTag ? '' : ''; }); } /** * Get an asset URL. * * @param {string} filename (without leading slash). * @returns {string} asset URL */ export const assetUrl = (filename) => `${window.GiveAddons.assetsUrl}${filename}`;