Giter Site home page Giter Site logo

holochain / docs-pages Goto Github PK

View Code? Open in Web Editor NEW
96.0 19.0 27.0 166.86 MB

The hosted static files for the Holochain developer documentation

Home Page: https://developer.holochain.org

License: GNU General Public License v3.0

JavaScript 10.08% CSS 11.43% TypeScript 4.64% Nunjucks 43.59% SCSS 30.26%

docs-pages's Introduction

Docs

This repo builds the documentation for developer.holochain.org generated by 11ty (https://www.11ty.dev/).

A note about browsers

Other than a warning to the user (see unsupported-brower-warning.njk if you care) no effort has been made to accommodate non-Evergreen browsers, which is mostly to say Internet Explorer of any version. There isn't a lot of js in the rendered site, but what there is won't work, and newer CSS features are used as well.

What the heck is 11ty (an extremely quick intro)

11ty, or Eleventy, is a NodeJS based static website generator. It supports a bunch of template types, including markdown and nunjucks (https://mozilla.github.io/nunjucks/) which we use here. By default any template file in the input directory will generate an html file in the generated site. It also supports includes and data generated content. It is extremely configurable and as such the docs (https://www.11ty.dev/docs/) can be a handful, but they are quite good and are worth a look.

How are we using 11ty

The 11ty config (.eleventy.js) is the final source of truth, but the basic setup is:

  • The output goes to _site.
  • Template files in /src/pages are transformed into html pages in the resulting site.
  • Page templates can have embedded data called Front Matter in YAML format.
  • /src/pages/_includes contains overall page layouts and helpers that can be called from the page template files
  • /src/pages/_data contains files that provide data that can be consumed by the templates. See Datafiles for details Uses:
    • Header Navigation
    • Contributors display
    • Community quotes display
    • Roadmap data
  • assets and client-side are static assets that get copied to _site, via calls to 11ty's .addPassthroughCopy.
  • copy-to-root (Not in place yet): sitemap.xml, robots.txt and _redirects (a Netlify config file with HTTP redirect commands). Copied to _site by 11ty's addPassthroughCopy.
  • Also see Using Markdown Here below.

Other artifacts

  • SCSS is compiled by sass via package.json script
  • /src/client-side is Typescript code that is compiled by via package.json script. When building for production it is also bundled into a single script for broader browser support.

Syntax highlighting

Syntax highlighting is applied server-side during the build process. The most popular highlighting tool for 11ty is syntaxhighlight, which uses Prism.js for formatting. We don't use this plugin. Instead, we use a custom transform based on highlight.js.

There are two reasons for this:

  1. highlight.js supports a lot more languages both natively and through extensions, including Svelte, which is used heavily in the Get Started guide.
  2. highlight.js also supports nested languages such as JavaScript and CSS inside HTML in a Svelte template.

Here is a list of all supported languages. Use a value from the 'Aliases' column as a tag on your GitHub-style code fence, like so:

```svelte
<main>
  {#if loading}
    <div>Loading...</div>
  {:else}
    <h1>Hello world!</h1>
    <p>The weather today will be {weather}.</p>
  {/if}
</main>
```

The tag will be added to the <code> element as a language-<tag> CSS class, along with a hljs tag. The surrounding <pre> element will also get a hljs-container class. We're using the atom-one-light theme that ships with highlight.js.

Using Markdown Here

We are using a mixture of markdown and nunjucks as the main page templates. For documentation pages (as opposed to more blingy pages like the home page) md is preferred.

By default 11ty uses the markdown-it parser and we stuck with that. Additionally the following markdown-it plugins have been added:

  • markdown-it-attrs allows, in particular, attributes and classes to be added. For example:

    [Holochain Launcher](https://github.com/holochain/launcher){#my-link target=_blank .a-super-cool-link}
    

    renders as

    <a href="https://github.com/holochain/launcher" id="my-link" target="_blank" class="a-super-cool-link">Holochain Launcher</a>
    

    There are of course more details. See the docs at markdown-it-attrs for more.

  • markdown-it-container Plugin for creating block-level custom containers. For example:

    ::: intro
    Blah blah
    :::
    

    renders as

    <div class="intro">
      <p>Blah blah</p>
    </div>
    

    Please note: The closing ::: is required. Also if you need to nest containers then the outer container gets an additional :. Each container type needs to be configured in markdown-it-config.js for examples and to add more. This one provides a lot of flexibility.

Site search and indexing

The site uses the Pagefind library to index the contents of the site and to find search results upon request. The documentation is quite good. One thing to note; pages are indexed based on the inclusion of the data-pagefind-body attribute on a page. It is included on all of the main pages (all but the Design System). If you need to remove some or all of a page from indexing you can use the data-pagefind-ignore attribute. See (https://pagefind.app/docs/indexing/) for details.

Setup for Dev

NPM Scripts of note

  • dev: Runs 11ty & SCSS compile with browser reload.
  • build: The Production build. Mostly used by CI/CD.
    • Cleans _site dir
    • Builds, autoprefixes and minifies the SCSS
    • Bundles the JS modules
      • Builds the Typescript to JS
      • Minifies the JS with Terser
      • Saves the module to _site/scripts/ dir
    • Builds 11ty with links to the bundled JS and minified CSS
  • clean: Cleans out the _site dir
  • build:search-index: builds the index files for the search function. This is called as pat of the build process, but if you want the search to work during local dev then you need to run this once, or you can just run build before you start the dev script.
  • update-browserlist: Updates the browserlist that autoprefixer uses determine what vendor prefixes are needed for your specified browser set. Run once in a while.

docs-pages's People

Contributors

a-jwc avatar abe-njama avatar alastairong avatar connoropolous avatar davhau avatar dcts avatar dependabot[bot] avatar dhtnetwork avatar freesig avatar friedger avatar guillemcordoba avatar harlantwood avatar jamesray1 avatar jost-s avatar klayemore avatar marycamacho avatar matthewnichols avatar matthme avatar mattyg avatar music2code avatar omahs avatar pdaoust avatar steveej avatar th1j5 avatar thedavidmeister avatar thetasinner avatar willemolding avatar zippy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docs-pages's Issues

Suggesting Edit: Hello Test Tutorial

Page URL: http://developer.holochain.org/docs/tutorials/coreconcepts/hello_test/

Remove the following section:

orchestrator.registerScenario("description of example test", async (s, t) => { const {alice, bob} = await s.players({alice: conductorConfig, bob: conductorConfig}) // Make a call to a Zome function // indicating the function, and passing it an input const addr = await alice.call("myInstanceName", "my_zome", "create_my_entry", {"entry" : {"content":"sample content"}}) // Wait for all network activity to await s.consistency() const result = await alice.call("myInstanceName", "my_zome", "get_my_entry", {"address": addr.Ok}) // check for equality of the actual and expected results t.deepEqual(result, { Ok: { App: [ 'my_entry', '{"content":"sample content"}' ] } }) })

This section mismatches what I've arrived to so far!

My code says this:
orchestrator.registerScenario('Test hello holo', async (s, t) => { const {alice, bob} = await s.players({alice: config, bob: config}, true); const result = await alice.call('cc_tuts', 'hello', 'hello_holo', {}); t.ok(result.Ok); t.deepEqual(result, { Ok: 'Hello Holo' })

Suggesting Edit: Hello Holo Tutorial

Page URL: http://developer.holochain.org/docs/tutorials/coreconcepts/hello_holo/

There is an issue compiling with 'hc package' in the 'Generate a Zome' section.
The config.toml file errors.
I found it works when I update the dependencies like this:

[dependencies]
serde = "=1.0.89"
serde_json = { version = "=1.0.39", features = ["preserve_order"] }
serde_derive = "=1.0.89"
hdk = { git = "https://github.com/holochain/holochain-rust", tag = "v0.0.34-alpha1" }
holochain_wasm_utils = { git = "https://github.com/holochain/holochain-rust", tag = "v0.0.34-alpha1" }
holochain_json_derive = "=0.0.17"

Suggesting Edit: Install Holochain

Page URL: http://developer.holochain.org/docs/install/

As per holochain/holochain-rust#1760, this page needs a couple of updates IMO.

Firstly, on my computer with Manjaro Linux, I need to pipe curl https://nixos.org/nix/install with a shell command, otherwise it doesn't work (see the above issue for details). E.g., as I use zsh by default, I ran curl https://nixos.org/nix/install | zsh, other common ones would be piped with bash or sh.

Secondly, I got:

[jr@lm ~]$ nix-env --versioncopy
error: no operation specified
[jr@lm ~]$ nix-env --version
nix-env (Nix) 2.3.1

So LTM like it needs to be updated to nix-env --version.

Suggesting Edit: Hello Me Tutorial - Check your code discrepancies in another box

Page URL: http://developer.holochain.org/docs/tutorials/coreconcepts/hello_me/

The Check your Code box after the definition of show_person is also wrong (seperate box from the error reported in #154

Specifically - the show_output in the code constructed line by line is ...

function show_output(result, id) {
  var el = document.getElementById(id);
  var output = JSON.parse(result);
  el.textContent = ' ' + output.Ok;
}

But in the "Check your code box" its

// Render functions
function show_output(result, id) {
  var el = document.getElementById(id);
  var output = JSON.parse(result);
  if (output.Ok) {
    el.textContent = ' ' + output.Ok;
  } else {
    alert(output.Err.Internal);
  }
}

With extra error checking ...

Confusing explanations about `native_type` in first_steps

What is the URL of the page with the issue?

https://developer.holochain.org/guide/latest/first_steps.html#adding-some-entries

What specific instruction was incorrect, or did not work for you?

Take note of the native_type field of the macro which gives which Rust struct represents the entry type.
(see source)

The example above this line does not contain any native_type field, so I'm very confused and not sure what I should take note of.

Probably the code code updated and not the text or vis-versa?

"Method not found". I'm doing "app/zome/method" format calls. All the doc pages regarding frontend interfaces are blank

Jimmy, [20 Jan 2019 19:28:50]:
...just dropped into the MatterMost chat, so we'll see there. Basically did the hc-rust todo list tutorial, got it running on a websocket server, but every call I make to it aside from "info/instances" returns "Method not found". I'm doing "app/zome/method" format calls.

and I was curious if any webhook RPC calls are documented anywhere aside from info/instances.

All the doc pages regarding frontend interfaces are blank

Though I know it's early in the process. I just assume they haven't been written yet.

Very early in the process myself, but so far it's not bad. It somewhat stinks that they changed to Rust/WebAssembly recently and invalidated most of the existing tutorials/sample apps in the process, but I understand the move, and ultimately it'll provide greater flexibility in the future. So I'm simultaneously having to learn Rust compared to other widely used languages. Though I think the design of the HC and the use of sharded DHTs and app specific crypto chains is a very cool concept.

Catalina

I'm opening this issue to investigate getting nix-shell to work on catalina. So far I can't find a working solution. It's not working for @dhtnetwork

Suggesting Edit: Install Holochain

Page URL: http://developer.holochain.org/docs/install/
After running the script in Linux, it says:
"Installation finished! To ensure that the necessary environment
variables are set, either log in again, or type

~/.nix-profile/etc/profile.d/nix.sh"

However, nix.sh in this location is not an executable.. the script should chmod +x nix.sh first. And presumably the daemon version also in that directory.

Update links on holochain.org website

Holochain.org home page
Change Request: Update links from Holochain proto to Holochain rust on the Holochain.org home page.

  1. Holochain.org home page / Resources
    Update link from proto to rust
  2. Holochain.org home page / Drop down menu
    Update Readme link from proto to rust

Suggesting Edit: Install Holochain

Page URL: http://developer.holochain.org/docs/install/

After the curl command (the next command) requires an update to the environment. The command line says this can be done by running ~/.nix-profile/etc/profile.d/nix.sh, except after the install this file needs to be chmod +x first. And this doesn't do it; you need to force the exports, the simplest way is to logout and log in again.

Suggesting Edit: Hello Me Tutorial

Page URL: http://developer.holochain.org/docs/tutorials/coreconcepts/hello_me/

Running into some strange compile errors while trying to follow on with this tutorial
CleanShot 2019-11-15 at 22 03 25@2x

And code:

#![feature(proc_macro_hygiene)]
#[macro_use]
extern crate hdk;
extern crate hdk_proc_macros;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
#[macro_use]
extern crate holochain_json_derive;

use hdk::holochain_core_types::{dna::entry_types::Sharing, entry::Entry};
use hdk::holochain_json_api::{error::JsonError, json::JsonString};
use hdk::{entry_definition::ValidatingEntryType, error::ZomeApiResult};
use hdk::holochain_persistence_api::{cas::content::Address};
use hdk_proc_macros::zome;

// see https://developer.holochain.org/api/latest/hdk/ for info on using the hdk library

#[derive(Serialize, Deserialize, Debug, DefaultJson, Clone)]
pub struct Person {
    name: String,
}

#[zome]
mod hello_zome {
    #[init]
    fn init() {
        Ok(())
    }

    #[validate_agent]
    pub fn validate_agent(validation_data: EntryValidationData<AgentId>) {
        Ok(())
    }

    #[zome_fn("hc_public")]
    fn hello_holo() -> ZomeApiResult<String> {
        Ok("Hello Holo".into())
    }

    #[entry_def]
    fn person_entry_def() -> ValidatingEntryType {
        entry!(
            name: "person",
            description: "Person to say hello to",
            sharing: Sharing::Private,
            validation_package: || {
                hdk::ValidationPackageDefinition::Entry
            },
            validation: | _validation_data: hdk::EntryValidationData<Person> {
                Ok(())
            }
        )
    }
    #[zome_fn("hc_public")]
    pub fn create_person(person: Person) -> ZomeApiResult<Address> {
        let entry = Entry::App("person".into(), person.into());
        let address = hdk::commit_entry(&entry)?
        Ok(address)
    }
}

Suggesting Edit: Hello Me Tutorial - test fails in Firefox, works in Chrome

Page URL: http://developer.holochain.org/docs/tutorials/coreconcepts/hello_me/
Using the code from the latter hello.js Check-your-code
In Firefox, the result of

var address = document.getElementById('address_in').value;

is
" Address: QmaijZvaP2BKj5r14KLTaB2yF4V1hukkSg7cJG6nLtNFSL"
While in Chrome its
"QmaijZvaP2BKj5r14KLTaB2yF4V1hukkSg7cJG6nLtNFSL"

In Firefox it of course fails to retrieve that, while Chrome works fine.

I don't understand why Firefox behaves like this ... as the DOM looks like

<div>Address: <span id="address_output"> QmaijZvaP2BKj5r14KLTaB2yF4V1hukkSg7cJG6nLtNFSL</span></div>

But its 100% repeatable and will leave you to debug it ....

Can we add instructions on how to install a specific versions/releases of "hc" and "holochain"

What is the URL of the page with the issue?

https://developer.holochain.org/start.html - under heading: "Permanently install holochain tools (optional)"

What specific instruction was incorrect, or did not work for you?

As the holochain team releases new versions this creates breaking changes, during the devcamps we will choose to stick to a specific version of holochain and hc and would like this the ability to install specific versions via nix-env

What are the details of your platform?

N/A

Can we modify the holochain install documentation to what is suggested in the image below?
2019-07-24_22-25-00

Update Windows Installation Instructions

  • Need to correct in Step 5 for windows: replace: %HOME%/hc with %HOME%\hc

also, to address issues with installing zmq; here's what I did that worked:

Doing this created a error when running "hc --version" in cmd that said, "libzmq-v140-mt-4_2_0.dll not found" This file is found in the above reference directory in the "bin" folder.

So, I moved libzmq-v140-mt-4_2_0.dll to the same folder where hc.exe lives --> and huzzah! It now works.

Things I don't know:

  • are the other zmq files still required? meaning, is it just libzmq-v140-mt-4_2_0.dll that's needed?
  • I did follow the process for building the zmq libraries using visual studio 2017 (per the instructions sort of given on http://zeromq.org/intro:get-the-software#toc10 ) -- however, while this did build successfully in VS17, my cmd was still throwing the error mentioned above. I haven't tested doing this installation from scratch with just the above method.

Suggesting Edit: Install Holochain

Page URL: http://developer.holochain.org/docs/install/

Note that if you will be running nix-shell https://holochain.love frequently, you may wish to set an alias, e.g. as instructed on this page.

Note that if you will be running `nix-shell https://holochain.love` frequently, you may wish to set an alias, e.g. as instructed on [this page](https://www.hostingadvice.com/how-to/set-command-aliases-linuxubuntudebian/).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.