12 lines
316 B
TypeScript
12 lines
316 B
TypeScript
/**
|
|
* Completes the shorthand [api:Something] syntax to [api:Something](Something)
|
|
* @param html
|
|
*/
|
|
const cleanApiTags = (html: string): string => {
|
|
return html.replace(
|
|
/\[api:(.*?)\]([^(])/g,
|
|
(_, query, next) => `<a href="${query}">${query}</a>${next}`
|
|
)
|
|
};
|
|
|
|
export default cleanApiTags; |