Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support data-line-numbers from reveal.js #266

Closed
asm0dey opened this issue Jun 23, 2019 · 11 comments
Closed

Add support data-line-numbers from reveal.js #266

asm0dey opened this issue Jun 23, 2019 · 11 comments
Milestone

Comments

@asm0dey
Copy link

asm0dey commented Jun 23, 2019

Currently reveal.js supports line highlighting in source code: https://github.com/hakimel/reveal.js/#line-numbers--highlights
Is it possible to support this feature in asciidoctor-revealjs?

@marcdexet-cnrs
Copy link

Hi.
I was previously using https://github.com/gnab/remark wich support a close feature just by adding an '*' in front of a code line.

It would be very useful for programing courses to be able to highlight particular line.

@mojavelinux
Copy link
Member

We support a similar feature in Asciidoctor. See https://asciidoctor.org/docs/user-manual/#highlight-select-lines (so the framework is there). I'm sure it's possible to get it working in this converter. The converter can retrieve this information from the node, massage it, and pass it on to data-line-numbers.

(What's funny about this is that highlight.js refuses to support line number itself. If it did, this would be something Asciidoctor would already set up).

@marcdexet-cnrs
Copy link

I have been trying with coderay and pygments.
The most appectable is coderay with inline.

As for remarkjs, it uses a simple hack: a '*' put at the beginning of a line inject a specific css class to highlight the whole row.

It produces think of highlithed code: https://marcdexet-cnrs.github.io/devworkshop5_tips_for_maintainability/#136

@marcdexet-cnrs
Copy link

The remark syntax is

.medium[We now can distinguish the **WHAT**...]

```python
*def check_propulsion_energy_against_duration(report, patrol_duration):

    average_energy_per_day = get_average_propulsion_energy_consumption_per_day()
    required_energy_level = patrol_duration * average_energy_per_day * SECURITY_COEFF + MINIMAL
    if required_energy_level > get_actual_stocked_energy() :
        report.register('propulsion_energy','NotEnoughEnergy', CRITICAL)
```
--

.medium[...from the **HOW**]
```python
def check_propulsion_energy_against_duration(report, patrol_duration):

*    average_energy_per_day = get_average_propulsion_energy_consumption_per_day()
*    required_energy_level = patrol_duration * average_energy_per_day * SECURITY_COEFF + MINIMAL
*    if required_energy_level > get_actual_stocked_energy() :
*        report.register('propulsion_energy','NotEnoughEnergy', CRITICAL)
```

@mojavelinux
Copy link
Member

Reveal.js uses highlight.js, which Asciidoctor already offers. This is a matter of configuring the integration in this converter. It's possible. The information needs to be passed from the AsciiDoc file to the HTML output. That's all.

@asm0dey
Copy link
Author

asm0dey commented Jul 21, 2019

Sorry, guys, I'm completely lost. If I've asked for something which asciidoctor-revealjs already offers — please close this task.

@mojavelinux
Copy link
Member

Not at all. I'm just saying it's within reach to enable it.

@asm0dey
Copy link
Author

asm0dey commented Jul 21, 2019

Oh, got it, thanks

@marcdexet-cnrs
Copy link

I have produced lately a few courses about software dev good practices and I really missed this feature. It makes examples very clear.
How can I help to get this feature in the next release ?

@obilodeau obilodeau added this to the 4.0.0 milestone Dec 31, 2019
@obilodeau
Copy link
Member

data-line-numbers was added in reveal.js 3.8.0. See these issues #296 and #301 for more context about the milestone attribution I just did.

@obilodeau
Copy link
Member

Support was merged in master minutes ago. Release soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants