Skip to content

How can I create a title page for a project with multiple modules? #410

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

Closed
MaddyGuthridge opened this issue Jul 5, 2022 · 5 comments
Closed

Comments

@MaddyGuthridge
Copy link

Problem Description

One of my projects consists of multiple modules, which due to design constraints cannot be merged under one umbrella. PDoc handles this very well, with a clear list of modules being shown in the left-hand panel on the landing page. However, since there is no main __init__.py file that I can include some markdown within (refer to the "include markdown files" section of the docs), it doesn't seem like I can take any action to customise the site's landing page.

Proposal

If there is a way to do this without employing any hacks or workarounds which would mess up my project's hierarchy, then add some more clear documentation to help users find info on it.

Otherwise, add support for a command line flag that lets you specify a markdown file to be included on the landing page for documentation of projects that use many modules.

Alternatives

I can't think of any

Additional context

Lots of empty space, which could benefit from adding a nice readme file.
image

@mhils
Copy link
Member

mhils commented Jul 6, 2022

Hi there!

I think you can relatively easily accomplish what you are looking for by overriding the index.html.jinja2 template:

custom-template/index.html.jinja2:

{% extends "default/index.html.jinja2" %}

{% block content %}
    <main class="pdoc">
    Hello World!
    </main>
{% endblock %}
pdoc -t custom-template/ ...

Hope that helps! Here's a more complex example:

{% extends "default/index.html.jinja2" %}

{% block title %}Hello World{% endblock %}

{% block nav %}
    <img src="https://pdoc.dev/logo.svg" class="logo" alt="project logo"/>
    <input type="search" placeholder="Search..." role="searchbox" aria-label="search"
                   pattern=".+" required>
    {{ super() }}
{% endblock %}

{% block content %}
    <main class="pdoc">

    {% filter to_html %}
# Hello World!
This is a test page with Markdown contents.
    {% endfilter %}
    <strong>You can also write plain HTML here!</strong>

    </main>
    {% include "search.html.jinja2" %}
{% endblock %}

@mhils mhils closed this as completed Jul 6, 2022
@MaddyGuthridge
Copy link
Author

Cool, thanks for the explanation! Do you think it could be worthwhile updating the documentation for it to make it more clear?

@mhils
Copy link
Member

mhils commented Jul 6, 2022

Actually that's a fair point. :)

@vivek87799
Copy link

Hi,
First I would like to thank you for the simple and a wonderful documentation tool.

I have a similar requirement for my project. I have created a custom-template dir with index.html.jinja2 file to override

pdoc -t .\demo_poc\custom-template\ .\demo_poc\

Unfortunately nothing changes. Can you kindly help me with this.

patnr added a commit to nansencenter/DAPPER that referenced this issue Jan 9, 2023
Reasons:

- pdoc is more mainstream
- pdoc *seems* a little better
- deployment without pushing to separate branch (gh-pages),
  thereby lighter GitHub actions workflow.

How to do stuff:

- mitmproxy/pdoc#410
- https://pdoc.dev/docs/pdoc.html#edit-pdocs-html-template
- https://github.com/mitmproxy/pdoc/blob/main/examples/custom-template/module.html.jinja2
patnr added a commit to nansencenter/DAPPER that referenced this issue Jan 9, 2023
Reasons:

- pdoc is more mainstream
- pdoc *seems* a little better
- deployment without pushing to separate branch (gh-pages),
  thereby lighter GitHub actions workflow.

How to do stuff:

- mitmproxy/pdoc#410
- https://pdoc.dev/docs/pdoc.html#edit-pdocs-html-template
- https://github.com/mitmproxy/pdoc/blob/main/examples/custom-template/module.html.jinja2
patnr added a commit to nansencenter/DAPPER that referenced this issue Jan 10, 2023
Reasons:

- pdoc is more mainstream
- pdoc *seems* a little better
- deployment without pushing to separate branch (gh-pages),
  thereby lighter GitHub actions workflow.

How to do stuff:

- mitmproxy/pdoc#410
- https://pdoc.dev/docs/pdoc.html#edit-pdocs-html-template
- https://github.com/mitmproxy/pdoc/blob/main/examples/custom-template/module.html.jinja2
@javiortizmol
Copy link

Hi, the steps that you suggested in the documentation didn't work

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

No branches or pull requests

4 participants