How to create hyperlinks in a new tab using CSS or Multimarkdown?

I use Text :: MultiMarkdown to create HTML files from MultiMarkdown .

I want all links to open in a new tab.

Is there a way to customize this behavior using a CSS template or directly in a MultiMarkdown document (without explicitly writing HTML around every link in a MultiMarkdown document)?

+5
source share
4 answers

Definitely not in CSS - this only applies to how elements appear, and not how they behave.

<base target="_blank"> HTML- ( XSLT), .

+8

HTML / JavaScript . UA, . .

+3

CSS, .

Text::MultiMarkdown _GenerateAnchor, - :

sub _GenerateAnchor {
    my ($self, $whole_match, $link_text, $link_id, $url, $title, $attributes) = @_;
    if($url
    && index($url, '#') != 0) {
        $attributes = $attributes ? $attributes . ' target="_blank"' : 'target="_blank"';
    }
    return $self->SUPER::_GenerateAnchor($whole_match, $link_text, $link_id, $url, $title, $attributes);
}

kludgey, _GenerateAnchor . OO, markdown.

Text::MultiMarkdown , . , , .

HTML::Parser HTML, Text::MultiMarkdown, target .

0

All Articles