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

Changed: word wrap(自动换行) for code #95

Closed
wants to merge 1 commit into from

Conversation

upupming
Copy link
Contributor

@upupming upupming commented Jun 15, 2018

I find long code cross one line is really difficult to read, so I add the word wrap(自动换行) feature, which also has to disable default line numbers.

Before

After

More examples

How to configure hexo for word wrap

  1. Modify the _config.yml in your blog's root folder to disable the line_number
highlight:
  enable: true
  line_number: false
  auto_detect: false
  tab_replace:
  1. For me, I need to update hexo-server to make preview displays properly
npm install hexo-server --save

Feature request

I have another idea, but I don't know how to achieve it. Apply word wrap according to the config in the blog's root _config file:

  1. Case line_number: true

    Use the normal scroll to view more of a long line.

  2. Case line_number: false

    Use word wrap.

@Molunerfinn
Copy link
Owner

Molunerfinn commented Jun 15, 2018

OK, I can do it. Thanks for your job, but I need to close it.


Update-1:

I find the hexo-renderer-stylus can't get the config of the root. It can just get the config of theme. If I can open a PR to add feature for this, then the users of theme-melody need to update their hexo-renderer-stylus, then it's a break change for theme-melody. I need to find a way to do this smoothly.

Update-2:

OK, I find a way to do this smoothly.

@upupming
Copy link
Contributor Author

Thanks, you always take your users into consideration. I'm very happy to be one of the fans of such a responsible developer!

@Molunerfinn
Copy link
Owner

@upupming Thanks! Your idea is also perfect! Thank you for your contribution~

By the way, may be someone really don't like line_number. So I think we should not only change the config of root, but also add a option in melody.yml like code_word_wrap to get this feature. I have done for it.

@upupming
Copy link
Contributor Author

Great, it works like a charm after I set code_word_wrap: true in melody.yml ~

@Molunerfinn
Copy link
Owner

Glad to hear that!

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

Successfully merging this pull request may close these issues.

2 participants