Code Monkey home page Code Monkey logo

docs-common-content's Introduction

docs-common-content

The content in this repo is shared, or can be shared, between multiple Antora-based documentation repos, such as:

Prerequisites

Glossary for this repo

child repo

This repo. Include this repo in the playbook.yml file of a parent repo.

parent repo

The repo for the Antora-based site that includes content from this repo.

child file

A file in this repo that you want to include in the parent repo.

parent file

The file in the parent repo that has an include:: directive to include a child file.

You can only use child files by using the AsciiDoc include directive to include a child file in a parent AsciiDoc file in the parent repo. The child file must be in the partials family directory.

If you directly reference a file in the pages family directory in a nav.adoc file, which defines the left navigation pane, clicking on the file in the pane leads Antora to go to the nav.adoc file of the module that contains the actual AsciiDoc file in the child repo. Because that module by its nature is not synchronized with a parent repo, Antora’s context switches to show the nav.adoc for the child module which means that the left nav pane is empty.

It’s much simpler to just include a file from the child repo with an include directive in a file in the parent repo.

Example

/modules/ROOT/partials/partial_glossary.adoc is a Glossary that I want to include in the parent repo as a standalone page.

To bring the child file into the parent site:

  1. Create a parent file in the parent site named glossary.adoc. For example, I created this file as https://github.com/starknet-io/starknet-docs/dev/components/Starknet/modules/ROOT/pages/glossary.adoc. Here’s the entire contents of glossary.adoc:

    include::1.0.0@docs-common-content:ROOT:partial$partial_glossary.adoc[]
  2. Include the child repo in the playbook under the sources key. For example:

      sources:
        - url: . (1)
          branches:
            - 'HEAD'
          edit_url: 'https://github.com/starknet-io/starknet-docs/edit/dev/{path}'
          start_paths:
            - components/Starknet
        - url: https://github.com/starknet-io/docs-common-content.git (2)
          branches: 'HEAD'
          edit_url: 'https://github.com/starknet-io/docs-common-content/edit/main/{path}'
    1. This section defines the main repo for the parent.

    2. This section is the child repo.

  3. Add the parent file to nav.adoc for the module in which you want to include it. You might have to experiment to place it as desired within the left nav pane.

If you make any changes to a child file, you need to manually regenerate the parent document.

Important

The Edit this page button in the parent document does not allow you to edit the child file directly, only files in the parent repo.

When a reader clicks Edit this page, the parent file opens. In order to enable the reader to make a direct contribution to the child file, you must add a comment with the URL that actually opens the child file in the Github editor.

For example:

The parent glossary.adoc file
include::1.0.0@docs-common-content:ROOT:partial$partial_glossary.adoc[]

// The source for the included file is in a separate repository.
//
// To edit the source page directly, go to:
//
// `https://github.com/starknet-io/docs-common-content/edit/main/modules/ROOT/partials/partial_glossary.adoc`

docs-common-content's People

Contributors

edgarbarrantes avatar jamestark avatar piavgh avatar stoobie avatar

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.