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

Request to display Line Numbers in Code Blocks #176

Closed
sna6 opened this issue Jan 7, 2025 · 3 comments
Closed

Request to display Line Numbers in Code Blocks #176

sna6 opened this issue Jan 7, 2025 · 3 comments
Labels
enhancement New feature or request

Comments

@sna6
Copy link

sna6 commented Jan 7, 2025

Would it be possible to add an option to display line numbers in code blocks?

For example, as seen here or here.

Also, I wanted to take this opportunity to say Otterwiki is terrific! I've been exploring a lot of wiki projects over the past week looking for a solution to do better personal documentation. I've only been using it for a few days but it ticks all the boxes for me. Thank you for your work and for sharing this project!

@redimp redimp added the enhancement New feature or request label Jan 10, 2025
@redimp
Copy link
Owner

redimp commented Jan 10, 2025

Hey @lj-tms, I think this would be a useful extension!

My question is what would be good syntax for the code block?

HackMD and HedgeDoc uses a = after the language keyword, e.g.

```bash=
#!/bin/sh
echo "Hello world."
```

This looks easy enough, but it "feels" not very intuitive. 🤔

@sna6
Copy link
Author

sna6 commented Jan 10, 2025

When I was tested wiki.js, the Line Numbers on Code Blocks feature was a site setting that applied to entire installation. For me personally, this would be ideal since I would use it on all code blocks.

But there may be other users that might want it on some code blocks and not others. In that case, your solution certainly looks easy enough to me.

This is my first time working with markdown, so I would certainly defer to you on the best implementation.

Thanks redimp!

redimp added a commit that referenced this issue Jan 11, 2025
As requested in #176 code blocks can be configured to display
line numbers by adding a = to the specified language. e.g.

```python=
print("Hello Line Numbers!")
```
redimp added a commit to metallkopf/otterwiki that referenced this issue Jan 12, 2025
As requested in redimp#176 code blocks can be configured to display
line numbers by adding a = to the specified language. e.g.

```python=
print("Hello Line Numbers!")
```
@redimp
Copy link
Owner

redimp commented Jan 23, 2025

Released in v2.9.0.

@redimp redimp closed this as completed Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants