added #shareRaw label

This commit is contained in:
zadam
2022-03-22 21:20:47 +01:00
parent 228564f843
commit 091d6a1cf1
5 changed files with 324 additions and 387 deletions

View File

@@ -215,6 +215,7 @@ const ATTR_HELP = {
"shareAlias": "define an alias using which the note will be available under https://your_trilium_host/share/[your_alias]",
"shareOmitDefaultCss": "default share page CSS will be omitted. Use when you make extensive styling changes.",
"shareRoot": "marks note which is served on /share root.",
"shareRaw": "note will be served in its raw format, without HTML wrapper",
"displayRelations": "comma delimited names of relations which should be displayed. All other ones will be hidden.",
"hideRelations": "comma delimited names of relations which should be hidden. All other ones will be displayed.",
},

View File

@@ -46,6 +46,7 @@ module.exports = [
{ type: 'label', name: 'shareAlias' },
{ type: 'label', name: 'shareOmitDefaultCss' },
{ type: 'label', name: 'shareRoot' },
{ type: 'label', name: 'shareRaw' },
{ type: 'label', name: 'displayRelations' },
{ type: 'label', name: 'hideRelations' },

View File

@@ -23,6 +23,13 @@ function getSharedSubTreeRoot(note) {
function register(router) {
function renderNote(note, res) {
if (note) {
if (note.hasLabel('shareRaw')) {
res.setHeader('Content-Type', note.mime);
res.send(note.getContent());
return;
}
const {header, content, isEmpty} = contentRenderer.getContent(note);
const subRoot = getSharedSubTreeRoot(note);