
import { marked } from 'marked';
import { MarkdownOptions } from './render';

export function base_url_walk_tokens(token: marked.Token, options: MarkdownOptions) {
	if (options.base_url) {
		if (token.type === 'link' || token.type === 'image') {
			token.href = (new URL(token.href, options.base_url)).toString();
		}
	}
}
