Chrome links

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Chrome links

ChrLipp
I wanted to set a chrome link inside an Asciidoctor file like:

chrome://extensions/[Extensions]

but the schema is not recognized and therefore no link is created. Is there a workaround for that?

Kind regards, CL
Reply | Threaded
Open this post in threaded view
|

Re: Chrome links

mojavelinux
Administrator
Christian,

Although Asciidoctor only recognizes the uri schemes http:, https:, mailto:, ftp: and irc: out of the box, you can convince it that any text is a link using the explicit 'link:' prefix. For example:

[source,asciidoc]
--
link:chrome://extensions/[Extensions]
--

which produces:

[source,html]
--
<a href="chrome://extensions/">Extensions</a>
--

This would be a great point to emphasize in the user manual. Thanks for raising it!

Another approach to solving this problem is to register a custom inline macro for the 'chrome:' scheme. Here's an example:

[source,ruby]
--
class ChromeUriMacro < Asciidoctor::Extensions::InlineMacroProcessor
  option :pos_attrs, ['text']

  def process parent, target, attributes
    target = %(chrome:#{target})
    text = attributes['text'] || target
    Asciidoctor::Inline.new(parent, :anchor, text, :type => :link, :target => target).render
  end
end
   
Asciidoctor::Extensions.register do |document|
  inline_macro :chrome, ChromeUriMacro
end
--

Now the following source:

[source,asciidoc]
--
chrome://extensions/[Extensions]
--

becomes

[source,html]
--
<a href="chrome://extensions/">Extensions</a>
--

Hopefully one of those options works for you!

Cheers,

-Dan


On Mon, Oct 21, 2013 at 8:17 AM, ChrLipp [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I wanted to set a chrome link inside an Asciidoctor file like:

chrome://extensions/[Extensions]

but the schema is not recognizes. Is there a workaround for that?

Kind regards, CL


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



--
Reply | Threaded
Open this post in threaded view
|

Re: Chrome links

mojavelinux
Administrator
In reply to this post by ChrLipp
Here's the documentation issue I filed:

https://github.com/asciidoctor/asciidoctor.org/issues/168

-Dan


On Sun, Oct 27, 2013 at 12:35 AM, Dan Allen <[hidden email]> wrote:
Christian,

Although Asciidoctor only recognizes the uri schemes http:, https:, mailto:, ftp: and irc: out of the box, you can convince it that any text is a link using the explicit 'link:' prefix. For example:

[source,asciidoc]
--
link:chrome://extensions/[Extensions]
--

which produces:

[source,html]
--
<a href="chrome://extensions/">Extensions</a>
--

This would be a great point to emphasize in the user manual. Thanks for raising it!

Another approach to solving this problem is to register a custom inline macro for the 'chrome:' scheme. Here's an example:

[source,ruby]
--
class ChromeUriMacro < Asciidoctor::Extensions::InlineMacroProcessor
  option :pos_attrs, ['text']

  def process parent, target, attributes
    target = %(chrome:#{target})
    text = attributes['text'] || target
    Asciidoctor::Inline.new(parent, :anchor, text, :type => :link, :target => target).render
  end
end
   
Asciidoctor::Extensions.register do |document|
  inline_macro :chrome, ChromeUriMacro
end
--

Now the following source:

[source,asciidoc]
--
chrome://extensions/[Extensions]
--

becomes

[source,html]
--
<a href="chrome://extensions/">Extensions</a>
--

Hopefully one of those options works for you!

Cheers,

-Dan


On Mon, Oct 21, 2013 at 8:17 AM, ChrLipp [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I wanted to set a chrome link inside an Asciidoctor file like:

chrome://extensions/[Extensions]

but the schema is not recognizes. Is there a workaround for that?

Kind regards, CL


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



--



--