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

Feature Request: Add option to add line numbers #35

Closed
tommyc38 opened this issue May 20, 2018 · 3 comments
Closed

Feature Request: Add option to add line numbers #35

tommyc38 opened this issue May 20, 2018 · 3 comments
Labels
Projects

Comments

@tommyc38
Copy link

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x ] feature request
- [ ] question

OS and Version?

Versions

Repro steps

The log given by the failure

Desired functionality

I think it would be sweet if you added the ability to add line numbers as an options to the directive. See https://github.com/wcoder/highlightjs-line-numbers.js

Mention any other details that might be useful

@MurhafSousli
Copy link
Owner

MurhafSousli commented May 21, 2018

For now, you can do this

import { Component } from '@angular/core';

declare const hljs: any;

@Component({
  selector: 'app',
  template: `
    <pre>
       <code highlight [code]="code" (highlighted)="onHighlight($event)"></code>
    </pre>
  `
})
export class AppComponent {

  code = `.......`;

  onHighlight(e) {
    hljs.initLineNumbersOnLoad();
  }
}

Here is a stackblitz

@MurhafSousli
Copy link
Owner

MurhafSousli commented May 30, 2018

It would be better if we can implement the lines numbers in this package without relying on an external dependency, if anyone can help on this, PRs are welcome!

@alissonbovenzo
Copy link

i really excited for this feature, i'll go try do anything about this and i'll go open a PR in few days
[]'s

@MurhafSousli MurhafSousli added this to To do in v4.0.0 Nov 11, 2019
@MurhafSousli MurhafSousli moved this from To do to In progress in v4.0.0 Nov 11, 2019
v4.0.0 automation moved this from In progress to Done Nov 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
v4.0.0
  
Done
Development

No branches or pull requests

3 participants