# extendify/3.0.4/src/Agent/lib/markdown.js

Extendify, version 3.0.4. 36 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.0.4/code/src/Agent/lib/markdown.js
- Raw: https://pluginprobe.com/plugins/extendify/3.0.4/raw/src/Agent/lib/markdown.js
- Modified: 2026-02-26T23:48:52+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/3.0.4/code/src/Agent/lib/markdown.js#L10-L20`.

```javascript
import { external, Icon } from '@wordpress/icons';

const homeUrl = window.extSharedData?.homeUrl;

const isExternalUrl = (url) => {
	try {
		const homeUrlObject = new URL(homeUrl);
		const urlObject = new URL(url);

		return homeUrlObject.hostname !== urlObject.hostname;
	} catch {
		return false;
	}
};

export const customComponents = {
	a: ({ href, children }) => {
		const isExternal = isExternalUrl(href);

		return (
			<a
				href={href}
				{...(isExternal && {
					target: '_blank',
					rel: 'noopener noreferrer',
				})}
			>
				{children}
				{isExternal && (
					<Icon icon={external} size={18} className="ml-0.5 inline" />
				)}
			</a>
		);
	},
};

```
