Inline source code highlighting

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

Inline source code highlighting

nawroth
Hi,

I'd like to use source code highlighting inline and wonder if there's a defined syntax for this already?
How about using for example: [language-cypher]`CREATE`

Is there any way to define shortcuts for the rather lenghty [language-langname] ?

/anders
Reply | Threaded
Open this post in threaded view
|

Re: Inline source code highlighting

mojavelinux
Administrator
Anders,

There's an open issue in which we've been discussing this feature. See https://github.com/asciidoctor/asciidoctor/issues/1043

My preference is actually an inline macro. I think inline macros are a lot easier to read _and_ is less typing.

source:cypher[CREATE]

Unfortunately, it's not yet possible to get passthrough behavior with inline macros, so you'd need to check for a passthrough in the content part in case it's needed.

source:cypher[+CREATE (with some characters to escape in here)+]

You can find some other proposals in the referenced issue. This is entirely possible to implement today using extensions...though I agree having it in core would be very interesting.

-Dan

On Thu, Oct 1, 2015 at 4:44 AM, nawroth [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

I'd like to use source code highlighting inline and wonder if there's a defined syntax for this already?
How about using for example: [language-cypher]`CREATE`

Is there any way to define shortcuts for the rather lenghty [language-langname] ?

/anders


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



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Inline source code highlighting

mojavelinux
Administrator
In reply to this post by nawroth
You could even shorten it to:

src:cypher[CREATE]

-Dan

On Sun, Oct 4, 2015 at 4:00 PM, Dan Allen <[hidden email]> wrote:
Anders,

There's an open issue in which we've been discussing this feature. See https://github.com/asciidoctor/asciidoctor/issues/1043

My preference is actually an inline macro. I think inline macros are a lot easier to read _and_ is less typing.

source:cypher[CREATE]

Unfortunately, it's not yet possible to get passthrough behavior with inline macros, so you'd need to check for a passthrough in the content part in case it's needed.

source:cypher[+CREATE (with some characters to escape in here)+]

You can find some other proposals in the referenced issue. This is entirely possible to implement today using extensions...though I agree having it in core would be very interesting.

-Dan

On Thu, Oct 1, 2015 at 4:44 AM, nawroth [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

I'd like to use source code highlighting inline and wonder if there's a defined syntax for this already?
How about using for example: [language-cypher]`CREATE`

Is there any way to define shortcuts for the rather lenghty [language-langname] ?

/anders


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



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Inline source code highlighting

Mark S
Is inline source code highlighting available yet, or ever likely to be? I'd find it useful.
Reply | Threaded
Open this post in threaded view
|

Re: Inline source code highlighting

mojavelinux
Administrator
It's not in core, but possible using an extension (inline macro).

To be honest, it's such a specialized use case, I think it's more appropriate to remain as an extension. It's a great example of why the extension system exists. Adding something to core requires very careful consideration and a lot of testing, so it's going to move slower by nature.

Best,

-Dan

On Fri, Aug 23, 2019 at 1:07 AM Mark S [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Is inline source code highlighting available yet, or ever likely to be? I'd find it useful.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Inline-source-code-highlighting-tp3783p7107.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: Inline source code highlighting

MattBlissett
In reply to this post by Mark S
With https://github.com/asciidoctor/asciidoctor/issues/1043#issuecomment-487058116 I'm generating inline syntax highlighting as in https://docs.gbif-uat.org/openrefine-guide/1.0/es/#_nuevas_columnas_a_partir_transformaciones_simples_de_otras_columnas

I haven't yet tidied up the code to avoid the inline patch, and I haven't got this to work in PDF yet either, but it shows how it might be done.