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

Ability to override the banner logo #24

Open
wimdeblauwe opened this issue Mar 26, 2021 · 5 comments
Open

Ability to override the banner logo #24

wimdeblauwe opened this issue Mar 26, 2021 · 5 comments

Comments

@wimdeblauwe
Copy link

I am investigating if I could use this project to document my https://github.com/wimdeblauwe/error-handling-spring-boot-starter library. It has quite some nice improvements over the default Asciidoctor stack.

I got it working by adding the milestone repo as plugin repo:

    <pluginRepositories>
        <pluginRepository>
            <id>spring-milestone</id>
            <name>Spring Milestone Repository</name>
            <url>https://repo.spring.io/milestone</url>
        </pluginRepository>
    </pluginRepositories>

One thing I would need is that I can override the banner-logo.svg (or just remove it) so people don't think my library is an official Spring one. Maybe also the doc-background.svg? Maybe it can be made configurable via an Asciidoc attribute?

@philwebb
Copy link
Contributor

I think the banner-logo definition is currently in css so you might be able to override it by providing an additional css file. We can certainly look into making things more configurable, but it might take a little while for us to get to that since the initial goal of the project is just to make our own documentation better.

@wimdeblauwe
Copy link
Author

No problem. I managed to work around it for now by excluding the images from being published:

      - name: GitHub Pages action
        if: |
          github.ref == 'refs/heads/master' &&
           matrix.java == 8
        uses: peaceiris/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./target/generated-docs
          exclude_assets: 'img/banner-logo.svg,img/doc-background.svg,img/doc-background-dark.svg'

You can view the result at https://wimdeblauwe.github.io/error-handling-spring-boot-starter/

@ciscoo
Copy link

ciscoo commented Jun 9, 2021

I was able to override with by defining a docinfo.html:

src/main/docs/asciidoc/docinfo.html

<link href="css/custom.css" rel="stylesheet">

The CCS:

src/main/docs/asciidoc/css/custom.css

#banner {
    background-image: url("../img/custom-banner-light.svg");
}

html.dark-theme #banner {
    background-image: url("../img/custom-banner-dark.svg");
}

#doc {
    background-image: url("../img/custom-header-doc.svg");
}

html.dark-theme #doc {
    background-image: url("../img/custom-header-doc-dark.svg");
}

@media screen and (max-width: 800px) {
    html.dark-theme #doc,
    #doc {
        background: none;
    }
}

and update task to include the custom resources:

tasks {
    asciidoctor {
        resources {
            from(sourceDir) {
                include("css/**", "img/**")
            }
        }
    }
}

philwebb pushed a commit to philwebb/spring-asciidoctor-backends that referenced this issue Jul 7, 2021
@gim-
Copy link

gim- commented Oct 16, 2022

Thank you @ciscoo, I had to enable docinfo by adding this to the top of my .adoc file though:

:docinfo: shared

@wzhiyog
Copy link

wzhiyog commented Apr 12, 2023

hi~What should maven do?

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

5 participants