Adding span id on a word

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding span id on a word

asotobu
Currently when you create an asciidoc document with next content:

This is an important token `1234` for you.

It is rendered to html as:

<div class="paragraph">
<p>This is an important token <code>1234</code> for you.</p>
</div>

But what I would like to do is an output like:

<div class="paragraph">
<p>This is an important token <span id="token"><code>1234</code></span> for you.</p>
</div>

I know that I could use passthrough operator, but is there any other way?

I know that I can surround words with span with a class but not an id http://asciidoctor.org/docs/user-manual/#custom-styling-with-attributes

Thank you very much.
Ted
Reply | Threaded
Open this post in threaded view
|

Re: Adding span id on a word

Ted
I'm not sure if there is another way?

This is an important token [#abc]`1234` for you.

produces
<p>This is an important token <a id="abc"></a><code>1234</code> for you.</p>

This gets a bit closer

This is an important token 
[#abc]
`1234` for you.

produces
<div id="abc" class="paragraph">
    <p><code>1234</code> for you.</p>
</div>

Docs for Id
http://asciidoctor.org/docs/user-manual/#id
- Ted @TedAtCIS
Reply | Threaded
Open this post in threaded view
|

Re: Adding span id on a word

asotobu
Thank you very much, I just didn't noticed this section.

Great. Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Adding span id on a word

mojavelinux
Administrator
Coincidentally, I just wrote a note to myself to revisit this. Even I expect that this markup:

[#idname]`text`

will produce

<code id="idname">text</code>

But, as Ted points out, it creates an anchor instead.

<a id="idname"></a><code>text</code>

This may have been done for compliance with AsciiDoc Python. But it makes very little sense, IMO. I'm going to explore changing it to the first form.

Of course, if you use custom templates, you can change this. I'd definitely like the html5s converter (https://github.com/jirutka/asciidoctor-html5s/blob/master/data/templates/inline_quoted.html.slim) to make the first form. Currently, it does not. I think we could start with a change there.

Cheers,

-Dan

On Fri, Sep 15, 2017 at 11:38 AM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Thank you very much, I just didn't noticed this section.

Great. Thanks.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Adding-span-id-on-a-word-tp5909p5911.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Adding span id on a word

asotobu
Sadly the output is:

<div id="abc" class="paragraph">
<p><code>1234</code>
for you.</p>
</div>

And what I would like is

<div id="abc" class="paragraph">
<p><code>1234</code></p>
</div>
<p>for you.</p>

Or something similar, but well custom templates might be an option.