Skip to content

publishing: Allow setting target format#13

Open
icorbrey wants to merge 1 commit into
treethought:mainfrom
icorbrey-contrib:icorbrey/publishing-format
Open

publishing: Allow setting target format#13
icorbrey wants to merge 1 commit into
treethought:mainfrom
icorbrey-contrib:icorbrey/publishing-format

Conversation

@icorbrey

@icorbrey icorbrey commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Adds the ability to choose a default publishing format (currently users can choose between Leaflet.pub, Pckt.blog, or plaintext), as well as adding a per-note override via the format frontmatter field.

let textContent = stripMarkdown(content);

let richContent: PubLeafletContent.Main | BlogPcktContent.Main | null = null;
const publicationFormat = pubUri ? normalizeFormat(plugin.settings.publicationFormats?.[pubUri]) : undefined;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we are choosing format based on pub URI, but below we are checking pub URL. I know you were testing with non leaflet/pckt publication so it likely works well in that case.

But If you try to use something like this in the settings (a leaflet pub mapped to pckt format)

  "publicationFormats": {
	  "at://did:plc:sppiplftd2sxt3hbw7htj3b5/site.standard.publication/3mdmrc7ka4c2w": "pckt"
  }

The mapping is overridden since the pub URL still contains leaflet. I'm aware that the pub url based selection is not great, and I intend to improve that. And I want to unblock you in the meantime.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry too much about blocking me! I didn't think about URI vs URL here

tags = fm["tags"] && Array.isArray(fm["tags"]) ? fm["tags"] : undefined;
publishedAt = fm["publishedAt"]; // Preserve existing if updating
}
format = normalizeFormat(fm?.["format"]);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here, format property from the frontmatter is not respected if the publication has URL that matches leaflet or pckt.

I've thought that mapping a publication to a content type format might be better done via some type of UI interaction. But for now I think a frontmatter property is a good option.

Let's update this PR to remove the publicationFormats setting since:

  1. its not shown in the settings UI and is more verbose
  2. showing it in the settings may be confusing for people who don't need it
  3. frontmatter property is simpler and more explicit.

If the property is set, we should not even bother checking the pub url and only use the property's format.

In the future I think we'd want to use full lexicon name, but the short leaflet and pckt are good for now

However, lets rename the property to be docContentFormat

Comment thread src/settings.ts
publicationFormats: Record<string, ContentFormat>;
}

export type ContentFormat = "leaflet" | "pckt" | "plaintext";

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets remove plaintext as an option, because the plaintext is always set for textContent regardless of the content field's format. If no content format is matched, then it can be left unset

@icorbrey
icorbrey force-pushed the icorbrey/publishing-format branch 2 times, most recently from 2608b56 to b867711 Compare February 10, 2026 15:57
@icorbrey
icorbrey force-pushed the icorbrey/publishing-format branch from b867711 to ae22f60 Compare February 23, 2026 13:37
Adds the ability to choose a default publishing format (currently users
can choose between Leaflet.pub, Pckt.blog, or plaintext), as well as
adding a per-note override via the `format` frontmatter field.
@icorbrey
icorbrey force-pushed the icorbrey/publishing-format branch from ae22f60 to b9047b2 Compare May 13, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants