JSFiddle - React, Tailwind, and code Playground

JavaScript

function convertInput(input) {
  // Extract the text between the brackets
  const text = input.replace(/\[\[(.*?)\]\]/, '$1');

  // Remove any whitespace and replace spaces with hyphens
  const slug = text.replace(/\s/g, '-').toLowerCase();

  // Create the desired output format
  const output = `[${text}](/post/${slug})`;

  return output;
}

// Prompt the user to enter the input
const userInput = prompt("Enter the Wiki-Link to Convert:");

// Call the function with user input
const result = convertInput(userInput);

// Display the result in a dialog box
alert(result);