Skip to content

Include some files from other repo? set the base url? #575

Closed

Description

@huglester

Hello,

I am playing with documenting some projects. But came to problem, where:

For example, I have documented modules like news, projects, navigation.

But now I need to write documentation for different websites for these modules. so actually only the 'base_url' which is mentioned in the pages will be used. is there a way to set it?

Other problem I see, is that, for example, I would like to make documentation of the news module in one place, navigation - other place.
And then, later, when I build the docs, I just link the external modules and compile them in...

That way, later, when news.md is updated on the main repo, I can rebuild every other page with it, just running the build command and it would fetch the updated repo, or something like that.

ANy ideas? Thanks

Activity

  1. d0ugal commented on Jun 1, 2015

    @d0ugal
    Contributor

    I'm not sure I fully understand. Is the main problem that you want to build markdown files across multiple repos?

  2. huglester commented on Jun 1, 2015

    @huglester
    Author

    There are two problems I am facing,

    1 question:
    in the readme, I often link to the main site, like:
    example.com/admin/pages
    example.com/admin/navigation

    but using this, if I build readme for different pages, I need to find/replace example.com with newdomain.com

    I think it would be good idea to add something like this in the config:

    theme: readthedocs
    variables:
        base_url: 'http://test.com'
        some_var: 'test variable'

    so in the markdown files, we could somehow use this variables. Maybe this is now possible? but I simply don't know how this is doable?

    2 question is:
    is there a way to build a markdown from external (i.e. git (gitlab), gist files)?

    So for example, I keep the main navigation.md file updated, and the mkdocs build would just git clone/pull this file/repo or something like this... Maybe config could look like:

    pages:
        About CMS: 'index.md'
        - 
          filename: 'news.md'
          title: 'News module'
          git: '[email protected]:docs/docs/module-news.git'
  3. waylan commented on Jun 1, 2015

    @waylan
    Contributor

    Regarding your first question, you can assign your own variables to extra:

    extra:
        base_url: 'http://test.com'
        some_var: 'test variable'

    Anything in extra will get passed directly to the template. Of course, you will need to use a custom theme to make use of those variables.

    Regarding your second question, that seems to me to be out of scope for MkDocs. You might want to look at git submodules or something similar. You would then need to run a git command to make sure everything it up-to-date before running mkdocs build.

  4. huglester commented on Jun 1, 2015

    @huglester
    Author

    Hello,

    understood. ok when maybe I will write some script to pull the repos.

    And returning to first question.
    Actually I need those variables not in the template, but inside Markdown files. is this possible?

  5. d0ugal commented on Jun 1, 2015

    @d0ugal
    Contributor

    Yup, extra is good for more flexible custom templates as @waylan said. There is no way to use these variables from within the markdown. I am not sure this is a case that we should support, I don't fully understand why you would want to do that.

  6. waylan commented on Jun 1, 2015

    @waylan
    Contributor

    Regarding using YAML variables within Markdown see #304.

  7. d0ugal commented on Jun 1, 2015

    @d0ugal
    Contributor

    Apparently I thought it would be useful in December, I can't remember why :) #304 (comment) ... I guess I can think of some use cases, but not that many are big issues for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions