Display page as text in publish

Use case or problem

I would like to share templates from my Obsidian vault using Obsidian publish, so I can easily share templates without having to format them differently or upload them somewhere else each time I change them. However, the YAML frontmatter and embeds are not present at all in the publish mode, it can be hard to tell which headings are which without good styling, and a user cannot copy/paste a template easily from the publish page.

Proposed solution

Two possibilities:

  • There could be a setting on a page that would allow you to display the given page in the publish form or as text (ideally with syntax highlighting/some other styling). This would basically replicate the old edit/publish mode but on Obsidian Publish. This could be controlled on the backend with the YAML frontmatter or publish menu or by the end user through a toggle.
  • There could be an option for the user to download the current page as a markdown file.

Current workaround (optional)

I asked on the discord and tzhou suggested this could be implemented on the user side using publish.css, but I haven’t gotten it to work well yet. Only thing on this I found so far was this thread. An issue with relying on publish.css as a fix for this is it applies the same css to all pages on the site, so it is limited to a site that is dedicated to hosting files as text only.