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

Generate stdlib doc pages #432

Merged
merged 14 commits into from Apr 19, 2023
Merged

Generate stdlib doc pages #432

merged 14 commits into from Apr 19, 2023

Conversation

vkleen
Copy link
Member

@vkleen vkleen commented Mar 28, 2023

This is a first attempt at integrating documentation for the Nickel standard library into the website.

  • Overhaul the ToC sidebar to also work with stdlib docs
  • Generate an overhaul ToC for the stdlib docs to link in the header

@github-actions github-actions bot temporarily deployed to pull request March 28, 2023 13:03 Inactive
@github-actions github-actions bot temporarily deployed to pull request March 31, 2023 10:15 Inactive
@github-actions github-actions bot temporarily deployed to pull request March 31, 2023 12:17 Inactive
@github-actions github-actions bot temporarily deployed to pull request April 11, 2023 13:51 Inactive
@github-actions github-actions bot temporarily deployed to pull request April 12, 2023 09:21 Inactive
@github-actions github-actions bot temporarily deployed to pull request April 12, 2023 09:54 Inactive
@vkleen
Copy link
Member Author

vkleen commented Apr 12, 2023

This PR will need rebasing for the dependency version bumps. Also, it's not clear to me if we want to merge this immediately into master, the flake.lock file and flake.nix specify Nickel master currently and there are numerous differences with the latest release 0.3.1. I'll mark it as ready for review anyway :)

@vkleen vkleen marked this pull request as ready for review April 12, 2023 14:25
@vkleen vkleen requested a review from yannham April 12, 2023 14:54
@vkleen vkleen force-pushed the integrate-stdlib-docs branch 2 times, most recently from e00d2e4 to 75dcfa3 Compare April 13, 2023 09:09
@github-actions github-actions bot temporarily deployed to pull request April 13, 2023 09:16 Inactive
Copy link
Member

@yannham yannham left a comment

Choose a reason for hiding this comment

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

LGTM, but checking "request changes" to be sure about the target branch of this PR and the target branch for Nickel set in the flake (the two don't seem to agree). Otherwise, code-wise, it's an accept

@@ -8,7 +8,7 @@

inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nickel.url = "github:tweag/nickel/stable";
inputs.nickel.url = "github:tweag/nickel";
Copy link
Member

Choose a reason for hiding this comment

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

Is it on purpose, or a left-over from tests? If we are going to target master, I suppose we should merge this PR in an unstable branch, and not in master. Although we plan to release 1.0 very soon.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that's left over from testing. It would probably make sense to merge this PR into an unstable branch on nickel-lang.org and change this input over before integrating into master.

gatsby-node.js Outdated
@@ -21,22 +23,29 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
frontmatter {
slug
}
parent {
Copy link
Member

Choose a reason for hiding this comment

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

What is this new node doing? Is it making accessible the name of the file or something?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's exactly what it does. Each node returned by the allMarkdownRemark query has a parent field, that is an instance of a File node.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, it doesn't give me the file name; it allows me to check which instance of gatsby-source-filesystem the markdownRemark node comes from. This is probably left over from my first attempts of rendering the stdlib. I should probably get rid of it, since we're now using the JSON documentation export and rendering the markdown manually.

gatsby-node.js Show resolved Hide resolved
actions.createNode(newNode);
actions.createParentChildLink({ parent: node, child: newNode })
}

Copy link
Member

Choose a reason for hiding this comment

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

I general I feel like this new blobs of code in this file could maybe be made easier to understand with a bit of documentation. I think I understand what it is doing, mostly pre-processing of stdlib and user manual data and make them readily available as structured data to be used easily by the other pages, but not sure I would get everything again in 6 months 😅

src/ace-nickel-mode/ace-nickel-mode.js Show resolved Hide resolved
Comment on lines 15 to 16
const slug = data.stdlibSection.slug;
const name = data.stdlibSection.name;
Copy link
Member

Choose a reason for hiding this comment

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

Nitpicky nitpick: I think we can write this in one line with const {slug, name} = data.stdlibSection;

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice 👍

@github-actions github-actions bot temporarily deployed to pull request April 14, 2023 12:20 Inactive
@github-actions github-actions bot temporarily deployed to pull request April 14, 2023 12:31 Inactive
@yannham yannham changed the base branch from master to unstable April 17, 2023 15:34
@yannham
Copy link
Member

yannham commented Apr 17, 2023

@vkleen I've created an unstable branch and made it the target. You'll probably have to rebase, but otherwise LGTM.

@github-actions github-actions bot temporarily deployed to pull request April 17, 2023 16:43 Inactive
@vkleen vkleen merged commit f0a1edc into unstable Apr 19, 2023
3 checks passed
yannham pushed a commit that referenced this pull request Apr 24, 2023
* Generate stdlib doc pages

* Tweak nickel syntax highlighting

* Use nickel stdlibJson

* Link to functions in stdlib sidebar

* Redirect /stdlib to /stdlib/array

* Hack hierarchical documentation into ToC sidebar

* Render nested documentation

* Take care of unused variable warnings

* Move prism highlight onEffect into the correct component

* Prototype for new stdlib hierarchy

* run npm install

* Address comments from code review

* Revert an experiment with rendering markdown nodes

* Run nix flake update
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.

None yet

2 participants