public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Multi-paragraph anchor in HTML
@ 2022-03-18 17:03 Pi Fisher
       [not found] ` <51e46a71-c669-4e1a-8074-cebcbad6c068n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Pi Fisher @ 2022-03-18 17:03 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1206 bytes --]

Hello,

I'm trying to write some markdown that, when compiled to HTML, will give me 
an anchor tag that covers multiple paragraphs (and a couple headings). 
Because the markdown for an anchor (`[link text](link-target)`) doesn't 
support multiple paragraphs, I'm using raw HTML tags. Here's an example of 
what I'm trying to do.

Input:
``````markdown
<a href="#top">

# Heading

Paragraph

</a>
``````

Desired output:
``````html
<a href="#top">
<h1 id="heading">Heading</h1>
<p>Paragraph</p>
</a>
``````

Real output:
``````html
<p><a href="#top"></p>
<h1 id="heading">Heading</h1>
<p>Paragraph</p>
<p></a></p>
``````

Is there a way to achieve what I'm trying to get? Possibly a way to say 
"don't wrap this line in a paragraph", or maybe an extension that allows 
for multi-paragraph links?

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/51e46a71-c669-4e1a-8074-cebcbad6c068n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 1826 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Multi-paragraph anchor in HTML
       [not found] ` <51e46a71-c669-4e1a-8074-cebcbad6c068n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-03-18 21:55   ` Bastien DUMONT
  2022-03-18 22:08     ` Gwern Branwen
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien DUMONT @ 2022-03-18 21:55 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

As for your first question, you can achieve this by inserting these tags as raw blocks:

```{=html}
<a href="#top">
```

# Heading

Paragraph

```{=html}
</a>
```

Le Friday 18 March 2022 à 10:03:28AM, Pi Fisher a écrit :
> Hello,
> 
> I'm trying to write some markdown that, when compiled to HTML, will give me an
> anchor tag that covers multiple paragraphs (and a couple headings). Because the
> markdown for an anchor (`[link text](link-target)`) doesn't support multiple
> paragraphs, I'm using raw HTML tags. Here's an example of what I'm trying to
> do.
> 
> Input:
> ``````markdown
> <a href="#top">
> 
> # Heading
> 
> Paragraph
> 
> </a>
> ``````
> 
> Desired output:
> ``````html
> <a href="#top">
> <h1 id="heading">Heading</h1>
> <p>Paragraph</p>
> </a>
> ``````
> 
> Real output:
> ``````html
> <p><a href="#top"></p>
> <h1 id="heading">Heading</h1>
> <p>Paragraph</p>
> <p></a></p>
> ``````
> 
> Is there a way to achieve what I'm trying to get? Possibly a way to say "don't
> wrap this line in a paragraph", or maybe an extension that allows for
> multi-paragraph links?
> 
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit [2]https://groups.google.com/d/msgid/
> pandoc-discuss/51e46a71-c669-4e1a-8074-cebcbad6c068n%40googlegroups.com.
> 
> References:
> 
> [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [2] https://groups.google.com/d/msgid/pandoc-discuss/51e46a71-c669-4e1a-8074-cebcbad6c068n%40googlegroups.com?utm_medium=email&utm_source=footer

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/YjT/3wcc1KerYnG6%40localhost.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Multi-paragraph anchor in HTML
  2022-03-18 21:55   ` Bastien DUMONT
@ 2022-03-18 22:08     ` Gwern Branwen
       [not found]       ` <CAMwO0gxOdcUTUkn=GCQ5kWnczT+CGmZi1bC6Oo9abywg7BxfOw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Gwern Branwen @ 2022-03-18 22:08 UTC (permalink / raw)
  To: pandoc-discuss

I'm not sure why it needs to be an <a> at all. Isn't this what <div>
tags are for? Set an ID on a div wrapper, and link as necessary. Spans
for inlines, and div for blocks.

Also, use of '#top' seems unnecessarily risky to me. That is already a
built-in browser anchor: every HTML page is considered to have a 'top'
element at the top of the page. Attempting to redefine it is asking
for subtle issues down the road.

--
gwern


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Multi-paragraph anchor in HTML
       [not found]       ` <CAMwO0gxOdcUTUkn=GCQ5kWnczT+CGmZi1bC6Oo9abywg7BxfOw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2022-03-18 22:58         ` Pi Fisher
  0 siblings, 0 replies; 4+ messages in thread
From: Pi Fisher @ 2022-03-18 22:58 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 758 bytes --]

Thank you Bastien! raw_attribute is just the extension I needed!

Gwern, I'm turning this into a link with an anchor and an href, not a link
target with an ID. I agree that using `top` as an ID is generally a poor
choice. (Also, for my MWE, I decided `#top` was shorter than `
http://example.com`. My real code goes somewhere else.)

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CA%2B380PxXVB5byHdgjfO9MSPswx3w49GsL7rrgV76PvKzUFukAQ%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 1161 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-18 22:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-18 17:03 Multi-paragraph anchor in HTML Pi Fisher
     [not found] ` <51e46a71-c669-4e1a-8074-cebcbad6c068n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-03-18 21:55   ` Bastien DUMONT
2022-03-18 22:08     ` Gwern Branwen
     [not found]       ` <CAMwO0gxOdcUTUkn=GCQ5kWnczT+CGmZi1bC6Oo9abywg7BxfOw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-03-18 22:58         ` Pi Fisher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).