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

Use HonKit instead of GitBook #720

Merged
merged 11 commits into from
Jul 8, 2020
Merged

Conversation

fanninpm
Copy link
Contributor

From what I've seen, HonKit appears to pick up where GitBook left off in development. Things were pretty much smooth sailing except for the fact that honkit install didn't exist (this was so that they could remove their reliance on npm so others could use yarn, for instance). I then learned that I had to create the package.json file below.

Alongside this pull request, I would also recommend changing this Wiki page to reflect the change to HonKit. Below, I have provided some sample text as a basis for what the relevant sections would look like.


Step 1.2 - HonKit

The next thing we need is HonKit (successor to GitBook), which is the tool that builds the AAA. By downloading HonKit, you can also build and serve the AAA locally on your computer.

HonKit can be retrieved via NPM or yarn. If you don't have NPM/Node.js installed on your system, you can download it here: https://nodejs.org/en/.

Step 2.3 - Building and running the AAA

Now that you have the AAA-repo on your machine, you first need to get all the packages the AAA requires to build. This can be done by running the following command in the same directory as your copy of the AAA-repo:

npm install  # or `yarn install`

After the all packages are downloaded, you can run/serve the AAA with this command:

npm run serve  # or `yarn run serve`

Once HonKit finishes building and starts serving, your terminal should've printed out something like the following:

This indicates that you successfully built the AAA! You can check out your local AAA by navigating to http://localhost:4000 in your browser.

Here you can see the AAA, just like it is on https://algorithm-archive.org:

When you're done with your local server, you can use ctrl + C to close the server.

Step 3.3 - Adding code to your AAA-repo

First of all, there are some things you need to know ("Skip a bit, brother.")

The instances mark places where code gets imported into the page. The very last place should import all files you created. The other places often just target specific functions (for example just a Sort() function as an explanation, but not all other code). To identify which exact function is needed, run the book (described in Step 2.3) via npm run serve and go to each code example.

The multLangIdentifier is important for HonKit to provide the language switcher that you see at the top of the algorithm pages. The multLangIdentifier is simply the file ending of the language you want to add.

Now you can run npm run serve again (or just let it rebuild automatically, if it is still running) and look at the page of the algorithm you're targeting. You should now be able to select your chosen language at the top and you should see your code in all places where code examples should be.

Step 3.7 - After the Pull Request: The Review

So, after someone reviewed your PR, you can just go ahead and correct the things the person pointed out. Doing that is fairly simple. Just checkout your branch locally (via git checkout your-branch-name), make corrections, run the book to check that everything is correct (via npm run serve) and then finally push the changes to your branch (via git push). Since the PR uses your branch, the changes immediately show up after you pushed them.

fanninpm added 4 commits June 29, 2020 14:24
This effectively turns the whole repo into a Node package, so tools like
`npm` and `yarn` can automate tasks such as dependency installation.
Please note that non-standard plugins are listed in both `book.json` and
`package.json`.
@fanninpm
Copy link
Contributor Author

fanninpm commented Jun 30, 2020

@berquist berquist self-requested a review June 30, 2020 15:18
@fanninpm
Copy link
Contributor Author

Here's the Travis build for commit 1c6c4f3, which passed: https://travis-ci.org/github/algorithm-archivists/algorithm-archive/builds/703575094

@leios
Copy link
Member

leios commented Jun 30, 2020

This looks really promising! Is it ready for review?

@fanninpm
Copy link
Contributor Author

@leios This is ready; however, I'll be offline for the next couple of hours.

@leios
Copy link
Member

leios commented Jul 1, 2020

Looks great! For some reason, the images are left-justified. That's the only problem I could find after building it locally. I'll dig deeper a bit later.

@berquist berquist self-assigned this Jul 5, 2020
- Remove duplicate fontsettings toggle
- Fix HTML files not including `styles/website.css`
@fanninpm
Copy link
Contributor Author

fanninpm commented Jul 5, 2020

@leios Does the latest commit work? It uses the latest version of HonKit, which fixes the problem you were seeing (c.f. honkit/honkit#89). You'd probably have to run npm i followed by npm run build --reload (or yarn install followed by npm run build --reload if you use yarn instead of NPM).

@Trashtalk217 Trashtalk217 self-assigned this Jul 6, 2020
@berquist berquist added the GitBook This is GitBook related. label Jul 7, 2020
@Trashtalk217 Trashtalk217 self-requested a review July 7, 2020 20:47
Copy link
Contributor

@Trashtalk217 Trashtalk217 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested the version locally and it creates a carbon copy of the site. But there are still a couple of differences:

  • different font, the font looks good, so that's fine.
  • we are no longer able to share the site via facebook or twitter, the heavens be praised and thanked.

Otherwise it's the exact same and I approve the pullrequest.

@leios
Copy link
Member

leios commented Jul 7, 2020

As a few quick notes:

The images are still left-justified, when they should be center-justified. All imaged have class="center" set in html, so I am not sure how to fix this.
EDIT: I am an idiot and didn't run the correct commands

In addition, the word count seems to be broken as well.

Copy link
Member

@leios leios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy with this. It seems Travis is also working. We'll leave it up for another day or so, to make sure everyone else has their say.

@leios
Copy link
Member

leios commented Jul 7, 2020

Also, as a note: I can no longer build with gitbook on my computer because of an update, so this would be nice to get in soon. I'll probably merge tomorrow if there are no other complaints.

Copy link
Member

@berquist berquist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dynamic sidebar works on local builds for me again! Rejoice!

@berquist berquist merged commit 2bfcd8b into algorithm-archivists:master Jul 8, 2020
@leios
Copy link
Member

leios commented Jul 8, 2020

WOO! I'll let you know if the build fails for whatever reason.

@c252
Copy link
Member

c252 commented Jul 8, 2020

Looks great!

@fanninpm
Copy link
Contributor Author

fanninpm commented Jul 8, 2020

For those of you looking at this PR and wondering how I got the CI to work, that was not me. Props to @berquist for solving the issues with our current CI setup in #728 and #729.

@fanninpm fanninpm deleted the honkit branch July 8, 2020 17:46
@berquist berquist mentioned this pull request Jul 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GitBook This is GitBook related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants