[pmwiki-users] Custom block link : <a href...>short html code rather than strict text link</a>

ABClf languefrancaise at gmail.com
Fri Oct 15 14:45:51 PDT 2021


Thank you Petko for your top notch answer ;
I'm going to try the last one soon.
Gilles.

Le ven. 15 oct. 2021 à 18:13, Petko Yotov <5ko at 5ko.fr> a écrit :
>
> Indeed, this is not possible with core PmWiki markup.
>
> In the past, the HTML standards required links to be inline elements
> which could not contain block-level elements like paragraphs or
> headings.
>
> So in PmWiki markup, you can have 2 links, one in the heading, the other
> in the text like this:
>
> !!!!! [[my link|Title]]
> [[my link|Some text]]
>
>
> Or you can have a specially formatted and styled link text like this:
>
> [[my link| %h5% Title %% Some text]]
>
> then you style .h5 in your pub/css/local.css, for example:
>
> .h5 {
>    display: block;
>    font-weight: bold;
>    font-size: 105%;
> }
>
> This will work well in <ul> lists for menus and navigation. I'd go with
> this solution id I needed the feature.
>
>
> Finally, and as usual, you can define your own markup rule to do this.
> For example:
>
>    Markup('blocklink', 'directives',
>      '/^\\(:blocklink(end|)(?: (.*?))?:\\)/',
>      'FmtBlockLink');
>    function FmtBlockLink($m) {
>      if($m[1]) return "<:block></a>";
>      return "<:block>".Keep("<a ".PQA($m[2]).">");
>    }
>
> Then in a wiki page, you type:
>
> (:blocklink href="https://www.pmwiki.org" class=myclass:)
> !!!!! Title
> Some text
> (:blocklinkend:)
>
>
> Petko
>
>
> On 15/10/2021 14:09, ABClf wrote:
> > Something I don't know how to do with pmwiki markup, if doable,
> > is having an html output like that :
> >
> > <a href="my link" class="myclass">
> >       <h5>Title</h5>
> >       <p>Some text</p>
> >   </a>
> >
> > (in order to have the full block working as a link, for easy click in
> > bootstrap-like list, and benefit of link's style).
> >
> > In other words, have some html code embedded in <a> and </a> (not the
> > sole text link).
> > I believe I can not use regular [[linkadress|linktext]] markup for
> > doing that.
> >
> > Thank you,
> > Gilles.



More information about the pmwiki-users mailing list