bouncepaw / mycorrhiza

🍄📑 Filesystem and git-based wiki engine for the independent web written in Go and using Mycomarkup as its primary markup language.
https://mycorrhiza.wiki
GNU Affero General Public License v3.0
307 stars 26 forks source link

Improved page printing #201

Closed hhartzer closed 1 year ago

hhartzer commented 1 year ago

Hi!

This is very cool!

With dokuwiki, if you try to print a page from your browser the printed contents appear to just be the rendered page itself without the Wiki bits. I'm not quite sure how this is done, but it seems useful. Does anyone else have any idea about that? I can dig in more later.

I have other ideas about printing as well to share if there is interest.

Thanks!

bouncepaw commented 1 year ago

I know how it's done and I'm pretty interested. What do you think should go into print?

hhartzer commented 1 year ago

Awesome! I think just the rendered "hypha", personally.

I like how the print looks for this page: https://www.dokuwiki.org/install

About my printing ideas in general, this would be much more complex but something I'm wanting to do is a wiki for the home. It'd be nice to be able to print the whole wiki to maintain a paper copy for people who are here.

I imagine this would work by printing with page numbers and the "home" page is page 1. From there, each hypha is its own page. Any interwiki links would make a citation to the page number of that hypha. So they would see on one page "Kitchen," a link to "Recipies" that would have the appropriate page number. I think this would need PDF export and probably settings for A4/US letter, etc.

I apologize if my terminology is wrong -- have only just started to play with mycorrhiza.

bouncepaw commented 1 year ago

Just the hypha? Well, looking at DokuWiki's printed version, they also have the site logo, filename (not releveant to Mycorrhiza), last modification time (not really relevant too, we don't show that information on regular hypha pages). DokuWiki doesn't seem to have any category system, but Mycorrhiza has one. Maybe it should be printed?

Looking at MediaWiki printed version. They too have the site logo and no categories as well. I wonder why, since MediaWiki supports them very well.

I like that both DokuWiki and MediaWiki use a fancy serif font in the printed version, we should do that too.

Making sitewide paper exports sounds fun. I think it belongs in a different project though. A special program that takes a Mycorrhiza wiki directory, and transforms it into a big PDF.

I feel like when you said ‘interwiki’, you meant ‘inside wiki’, but it actually means ‘between different wikis’. ‘Inside wiki‘ links are called local links.

hhartzer commented 1 year ago

Oh, that is true. Dokuwiki does print some extra stuff. I feel like I'd start simple and bare with it, and later maybe add the option, if possible, to turn on including the header. I think that either way it'd be useful for most people, with basic header/categories or not. But if I'm printing an individual page I would probably want more the page contents than any "wiki-isms" in it -- otherwise I would be using it online.

I do think the hypha page title should be at the top.

Oh, I am mistaken about "interwiki" -- I meant inside wiki. And I agree, its own tool might make the most sense. I could see this being an online feature as well, it but it would add bloat. A wiki PDF export link of sorts.

bouncepaw commented 1 year ago

later maybe add the option, if possible, to turn on including the header.

No need. Custom CSS is supported. Actually, you can have printed CSS right now. I've played around and came up with something. Use the following stylesheet. To use it, create file static/custom.css in your wiki directory and paste the following text there.

@media print {
    header,
    .btn_navititle,
    h1 a:first-of-type,
    .prevnext,
    #hypha-bottom,
    .categories-card h2,
    .categories-card input,
    .btn.categories-card__btn {
        display: none;
    }
    .categories-card {
        margin-top: -.5rem;
    }
    .categories-card ul {
        display: inline;
    }
    .categories-card li {
        display: inline;
        margin-left: 1rem;
    }
    main {
        padding: 1rem 2rem;
        font-family: Georgia, serif;
    }
}

Could you test it out and give feedback? If it is ok, I'll add it upstream.

bouncepaw commented 1 year ago
Снимок экрана 2023-08-01 в 01 49 07

Looks quite fine!

hhartzer commented 1 year ago

Wow! Thank you!

That looks good here, but I personally don't care for the Subhyphae section in the print output. Otherwise, looks great!

bouncepaw commented 1 year ago

Oh yeah, the subhyphae section. Adding .subhyphae, before header, will do the trick.

I'll add the styles to Mycorrhiza later and close the issue then. Thanks for bringing my attention to this.

hhartzer commented 1 year ago

I saw .header, and adding .subhyphae before it seemed to break things. I might've done something wrong, though.

Very cool! Thank you so much!