Text Manipulation
This is a Toolkit for work with text. You can analyse selected text, get statistics, find and replace text, and modify it in various ways.
Lorem Ipsum Text Generator 🔧
Generate Lorem Ipsum text. You can choose between ... (Read more)
Text Case Converter 🔧
Transform the selected text to a different case. Y... (Read more)
// Author: Eduard Uffelmann
// Linkedin: https://www.linkedin.com/in/euffelmann/
// Twitter: @schmedu_
// Website: https://schmedu.com
import "@johnlindquist/kit";
let input = await getSelectedText();
let buildPreview = ([search, replacement]) => {
if (!search) return md(input);
if (!replacement)
return md(
`${input
.replaceAll("\n", "<br>")
.replaceAll(search, `<ins>${search}</ins>`)}`
);
return md(
`${input}
${replacement
.split(",")
.map((item) => {
return input
.replaceAll("\n", "<br>")
.replaceAll(search, `<ins>${item}</ins>`);
})
.join("<br>")}`
);
};
let [search, replacement] = await fields({
fields: ["Search", "Replacement"],
preview: buildPreview(["", ""]),
onChange: async (input, state) => {
let preview = buildPreview(state?.value);
setPreview(preview);
},
});
let result = `${input}
${replacement
.split(",")
.map((item) => {
return input.replaceAll(search, `${item}`);
})
.join("\n")}`;
// Output
await setSelectedText(result);
Get Reading Time of Text 🔧
How much time does the text take to read? Just sel... (Read more)
Get The Toolkit Now!
You can install the 'Text Manipulation' Toolkit now and start using it today! It's free!