devhints
The devhints site offers a number of cheatsheets :
Though not all of them but the layout is almost exactly how i want it, so if you need to make cheatsheets try to do it with this format.
installation
You can spend a LOT of time staring at the same error if you don't install it exactly like described here.
Error
Unable to resolve dependency: user requested 'did_you_mean'
Never mind using yarn, it just seems to hang forever, npm can do this better.
This helped when the bundler got into an error installing :
| fresh install | |
|---|---|
jekyll
Now you got that running, maybe it is better to skip right top the base of this site : jekyll.
Jekyll is a ruby website framework to
Important
Transform your plain text into static websites and blogs
Which of course sounds like music in my ears.
| bundler | |
|---|---|
editing and adding content
I have stripped down the devhints source tree and now only serve 'own' topics since you can see the others on the real devhints.io page. However there are large gaps between editing sessions so here is a small work instruction for adding content.
running the dev server
We use jekyll but it is started by node, so :
adding content
Decide on the category for you new topic and place it in the header :
| category | |
|---|---|
The category has to exist or it just won't show up !. See next chapter if you need a new category.
Note the prism_languages, you need to provide which languages you use inside the script. See next chapter.
syntax highlighting
Jekyll/devhints.io uses prism : visit
A simple way to provide highlighting and syntax-coloring in code is creating a piece of code like this :
| syntax coloring | |
|---|---|
The data-line highlights the given lines if you want to. However this is not enough because you have to specify the languages you use in the md file for the coloring to show. It is done in the header :
| specify languages | |
|---|---|
categories
The categories are in _data/categories.yml. It is a plain yaml array that get's traversed at compile time so Add it where you want it to appear, if there are no topics using this category it will still show as empty:
I tried it... you can use spaces !
home
The home page is inside the _layouts/2017 directory, you can see the building of the main page there in home.html.
- It starts with the title {{site.data.content.home.title}} , which can be found in _data/content.yml.
- Then the tagline change that as well.
- Then there is the search line, also the prefix can be changed in content.yml
- Below that is a loop that displays all featured_pages, which is defined in the same page at the top : all pages which page.tags contains 'Featured'
That last one one shows how to get a topic displayed as a 'block' at the top :
| featured | |
|---|---|
In the beginning we only have a couple or so cheatsheets, so add this tag to all of them !
deployment
To be done.. it will be a docker file, look inside package.json for a production or build option !
troubleshooting
development refresh
When you start in dev mode jekyll starts in watch mode and you can see it recompile on every file change :
| developer mode | |
|---|---|
neat...
But this works only for source files, and not if you change for instance the categories, or if you add a file. However you can force it to reread by editing index.md and just writing it !