go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.8k stars 5.47k forks source link

full screen/page markdown rendering #24209

Open ericLemanissier opened 1 year ago

ericLemanissier commented 1 year ago

Feature Description

Gitea is already a great to to write documentation using markdown+mermaid. So much that it makes one want to be able to read such documentation in full screen, or be able to print it. The main point is to remove what is above and below the rendered markdown in the current web interface of both the Code and Wiki section of a repo.

Currently, the only way to partially do this is to:

  1. call gitea's markdown API
  2. transform the returned html fragment to turn all <pre class="code-block is-loading"><code class="chroma language-mermaid">...</code></pre> into <div class="mermaid">...</div>
  3. append <script type="module">import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';</script> to the fragment
  4. enclose the fragment in <html><body>...</body></html>

The rendering is not identical to what gitea renders, the evidence is that mermaid graphs generated with the 4 steps are not rendered in an iframes and are left aligned, contrary to mermaid graphs rendered directly by gitea which are in an iframe and centered. Also, gitea's CSS is not applied to the rendering. What is more, this does not cover KaTeX for math.

Screenshots

No response

silverwind commented 1 year ago

The server can not do any client-side rendering like math or mermaid. This request would probably require a button on checked-in markdown files where a separate printable render page opens in a new tab, which will require separe JS entry points etc. Certainly not trivial, but doable.

voronind-com commented 1 year ago

+1 on this. currently I use Firefox extension to render raw markdown and then print it. would really love the ability to hide gitea top and bottom when hitting print!