daattali / beautiful-jekyll

✨ Build a beautiful and simple website in literally minutes. Demo at https://beautifuljekyll.com
https://beautifuljekyll.com
MIT License
5.4k stars 16.27k forks source link

Few issues with code blocks, and some questions. #117

Closed Darkhax closed 8 years ago

Darkhax commented 8 years ago

After testing out a this theme, I have noticed a few issues with code blocks. (not that I am using ' rather than ` for this issue, because I couldn't work out how to escape it lol) I get the feeling that these issues are more so limitations of the tools used rather than this project, so at the very least this will help others who are having these issues.

The first issue is related to syntax highlighting. I believe there may be some case sensitivity with it. If you were to use '''Java it will not work. But if you use '''java it will.

The second issue is with new lines. If you start a code block directly after text, it will break the formatting. To prevent this, a new line must be between them.

As for my questions, I am wondering if line wrapping on code blocks has been worked out. I am currently writing tutorials about Java programming, and the line wrapping on code blocks can be quite the eye sore. You can see an example page here. I had tried fixing it myself, however the best I could do is disable all line wrapping, which turned all code blocks into one line. I am not very familiar with css though lol.

I have also noticed that the url in the top left links to the github site rather than my domain, which throws a 404. Would you happen to know what I did wrong? The repo for the site can be found here

Thanks for your time, and this awesome theme :)

daattali commented 8 years ago

Hi @darkhax , as you suspected, all these issues are 100% to do with markdown, and I can't offer much help with them. I also run into random issues like these often with markdown (especially with code blocks, they really are trickier), and every time I just do a lot of googling. Unfortunately markdown code blocks are not super trivial like most other markdown features. The issue with the new line is pretty standard though with markdown - it's the same problem that lots of people have where they can't figure why you always need to have a blank line (ie press Enter twice) in order to actually have a blank line in the output. All these things are just markdown difficulties that we all have to do deal with... Sorry I can't be of more help. It's good that these problems are happening mostly with code blocks and not with other formatting elements, because generally if you're writing code blocks that means you have some basic coding knowledge and should be able to figure out how to fix these issues :)

daattali commented 8 years ago

One thing you can experiment with: there are different markdown parsers and different syntax highlighters. They all work differently and each have their own issues. You can change them here: https://github.com/daattali/beautiful-jekyll/blob/master/_config.yml#L101-L102

You can read the jekyll documentation to see what other markdown/highlighter options are available. I don't remember the difference between them or why I chose these specific ones, but you can experiment with them.

daattali commented 8 years ago

One thing you can experiment with: there are different markdown parsers and different syntax highlighters. They all work differently and each have their own issues. You can change them here: https://github.com/daattali/beautiful-jekyll/blob/master/_config.yml#L101-L102

You can read the jekyll documentation to see what other markdown/highlighter options are available. I don't remember the difference between them or why I chose these specific ones, but you can experiment with them.

Darkhax commented 8 years ago

Thanks for the help. The issues I mentioned are not serious, just interesting quirks. Might be worth documenting them on the readme to help those who come across them in the future.

As for the line wrapping, I was able to fix it by adding the following bit to main.css. I haven't tested enough to know if there are any side effects, but it seems to have worked for me.

pre code {
  white-space: pre;
}

Thanks again

daattali commented 8 years ago

I've done that a few months ago already https://github.com/daattali/beautiful-jekyll/blob/master/css/main.css#L594-L596

I guess you forked the repo a long time ago so you didn't have that? But yes that is a good CSS to add

Darkhax commented 8 years ago

That's odd. I actually forked the project just a few days ago. I am currently working out of the gh-pages branch. That might explain a lot of the quirks I have been coming across.

daattali commented 8 years ago

Yes, you definitely shouldn't be working off the gh-pages branch. I realized that after trying to see what's wrong with your repo, and because of that I added a new section to the README and I also added a warning in the gh-pages README. Basically, I recommend you delete the gh-pages branch and create it again using master. Because all my work goes into master.

daattali commented 8 years ago

Sorry for not letting you know!