emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* named anchors in HTML export
@ 2017-08-18 21:43 Adam Spiers
  2017-08-19  8:50 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Spiers @ 2017-08-18 21:43 UTC (permalink / raw)
  To: org-mode mailing list

Hi there,

I'm using org2blog and trying to mark certain parts of a blog post
with a named anchor for permanent linking. However, org2blog relies on
Org's native HTML export, so really this post is just questions about
HTML Export.

I've managed to get sections anchored using a CUSTOM_ID property.
However based on

    http://orgmode.org/manual/Internal-links.html#Internal-links

I was also expecting to be able to use #+NAME: foo in front of a
headline or even other elements like paragraphs, but this doesn't
work. Is this a bug, or am I misreading the manual?

 Is there any way of creating an anchor for an arbitrary element,
short of some ugly "+HTML" hack?

By the way, this question is also being tracked here:

    https://github.com/org2blog/org2blog/issues/239

Thanks!
Adam

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

* Re: named anchors in HTML export
  2017-08-18 21:43 named anchors in HTML export Adam Spiers
@ 2017-08-19  8:50 ` Nicolas Goaziou
  2017-08-19 22:43   ` Adam Spiers
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2017-08-19  8:50 UTC (permalink / raw)
  To: Adam Spiers; +Cc: org-mode mailing list

Hello,

Adam Spiers <orgmode@adamspiers.org> writes:

> I was also expecting to be able to use #+NAME: foo in front of a
> headline

You cannot use a NAME keyword to a headline (or an inlinetask).
CUSTOM_ID is morally equivalent, though.

> or even other elements like paragraphs, but this doesn't
> work. Is this a bug, or am I misreading the manual?

Currently, "ox-html" doesn't create an anchor for named paragraphs,
unless the paragraph consists of an image only.

However, you can put targets anywhere in a paragraph using <<target>>
syntax.

>  Is there any way of creating an anchor for an arbitrary element,
> short of some ugly "+HTML" hack?

Note that internal references are... internal. You can use them across
documents only when using Org publishing mechanism. IOW, <<target>>
doesn't create <a id="target"></a> anchor, but something like <a
id="org1234567"></a>.

Regards,

-- 
Nicolas Goaziou

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

* Re: named anchors in HTML export
  2017-08-19  8:50 ` Nicolas Goaziou
@ 2017-08-19 22:43   ` Adam Spiers
  0 siblings, 0 replies; 3+ messages in thread
From: Adam Spiers @ 2017-08-19 22:43 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org-mode mailing list

On 19 August 2017 at 09:50, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Adam Spiers <orgmode@adamspiers.org> writes:
>> I was also expecting to be able to use #+NAME: foo in front of a
>> headline
>
> You cannot use a NAME keyword to a headline (or an inlinetask).
> CUSTOM_ID is morally equivalent, though.
>
>> or even other elements like paragraphs, but this doesn't
>> work. Is this a bug, or am I misreading the manual?
>
> Currently, "ox-html" doesn't create an anchor for named paragraphs,
> unless the paragraph consists of an image only.
>
> However, you can put targets anywhere in a paragraph using <<target>>
> syntax.
>
>>  Is there any way of creating an anchor for an arbitrary element,
>> short of some ugly "+HTML" hack?
>
> Note that internal references are... internal. You can use them across
> documents only when using Org publishing mechanism. IOW, <<target>>
> doesn't create <a id="target"></a> anchor, but something like <a
> id="org1234567"></a>.

Thanks Nicolas, that's super helpful!

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

end of thread, other threads:[~2017-08-19 22:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-18 21:43 named anchors in HTML export Adam Spiers
2017-08-19  8:50 ` Nicolas Goaziou
2017-08-19 22:43   ` Adam Spiers

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).