spark-ai-boy31 downloads把 Obsidian 笔记转换为微信公众号、今日头条的排版样式,支持自定义主题,一键复制富文本并粘贴到平台编辑器。
Social Formatter is an Obsidian plugin that converts Markdown notes into WeChat Official Account and Toutiao article styles. Pick a built-in theme or design your own, preview the result, then copy rich HTML straight into the platform editor.
Requires Obsidian 1.13.0 or newer.

<style> tags, so formatting survives the platform editor.Once the plugin is listed, install it from Settings → Community plugins → Browse, search for Social Formatter, and enable it.
Build or download main.js, manifest.json, and styles.css.
Create this folder in your vault:
<vault>/.obsidian/plugins/social-formatter/
Put the three files in that folder.
Open Settings → Community plugins, disable Restricted mode, and enable Social Formatter.
npm ci
npm run check
npm run package
npm run package creates dist/obsidian-social-formatter-<version>.zip for local distribution. GitHub Releases contain the three files Obsidian downloads: main.js, manifest.json, and styles.css.
Commands:
If no Markdown note is active, the plugin opens a note picker.
Click the star in the preview toolbar to make the current theme the default. The selected theme is used the next time you open the preview.
The platform header reads optional frontmatter fields: author, account, location, and published. Missing values fall back to the plugin metadata and the current date. The header and bottom action bar are preview-only; they are never included in the copied article HTML.
Based on the reading metrics of the reference WeChat article:
A modern WeChat theme with a green accent, pill headings, card quotes, and dark code blocks.
Based on the mobile reading metrics of the reference Toutiao article:
Light code blocks, underlined headings, and card quotes for opinion pieces and long-form writing.
Open Settings → Social Formatter, then use the built-in theme rows or the new-theme row:
Editable settings include font family, body size, line height, letter spacing, paragraph spacing, content width, padding, text/heading/accent/background/border colors, heading scale and weight, heading decoration, quote style, code theme, and corner radii.
The preview uses a Shadow DOM, so custom CSS cannot leak into the Obsidian interface. Start rules with .sf-content:
.sf-content {
--sf-accent: #7c3aed;
--sf-accent-soft: #f2ecff;
}
.sf-content h2 {
letter-spacing: 0.08em;
}
.sf-content p {
text-indent: 2em;
}
The copy step reads the final computed styles and writes them as inline style attributes. Normal CSS rules for typography, color, spacing, borders, backgrounds, and shadows are preserved.
Available CSS variables:
--sf-accent --sf-accent-soft --sf-text
--sf-heading --sf-strong --sf-muted
--sf-bg --sf-border --sf-font
--sf-font-size --sf-line-height --sf-letter-spacing
--sf-paragraph-gap --sf-content-width --sf-heading-weight
--sf-strong-weight --sf-h1-size --sf-h2-size
--sf-h3-size --sf-radius --sf-image-radius
Useful classes:
.sf-content .sf-title .sf-code-block
.sf-quote .sf-table .sf-callout
.sf-callout-title .sf-task-list .sf-checkbox
.sf-tag .sf-math .sf-figure
.sf-image .sf-align-center .sf-align-right
Limitations:
::before / ::after) are preview-only and are not copied.position, float, or flex/grid may not survive the platform editor.Local images are embedded as Base64. Some platform editors do not upload Base64 images automatically; re-insert the image if it is missing after pasting.
Remote images keep their original URL. If the platform blocks hotlinks, re-upload the image manually.
The per-image size limit is configurable in settings (8 MB by default). Images over the limit are skipped with a warning.
A Markdown image title becomes a caption:

For Obsidian wiki images, ![[image.png|300]] uses 300 as the image width.
External links keep their URL and styling. WeChat article links are often not clickable; this is a platform limitation.
Internal links are converted to plain text.
Formulas are reduced to copyable text. Mermaid, Excalidraw, and Canvas content is replaced with a placeholder.
Embedded notes are not recursively expanded. Videos, audio, and iframes are removed.
vault.getMarkdownFiles) so you can choose a note to format. It reads only the selected note and the local images it references.MarkdownRenderer, then normalize the result into portable HTML.text/html and text/plain to the clipboard, falling back to plain text when rich clipboard writes are restricted..github/workflows/ CI and release workflows
scripts/ Version check and packaging scripts
src/
main.ts Plugin entry, commands, note picker, direct copy
exporter.ts Rendering, computed styles, inline HTML, clipboard export
markdown.ts Markdown preprocessing and image tokens
images.ts Image resolution and Base64 embedding
normalize.ts Obsidian output to portable social HTML
themes.ts Built-in themes, theme CSS, sample content
clipboard.ts Rich/plain clipboard writing
ui/PreviewModal.ts Preview, platform and theme switching, copy
ui/ThemeEditorModal.ts Custom theme editor
ui/SettingsTab.ts Settings and theme library
npm run typecheck
npm test
npm run build
npm run check
Node 22 is the supported development version (.nvmrc).
main/master, pull requests, and manual dispatches. It installs dependencies, validates version metadata, runs typecheck and tests, builds the plugin, and uploads the plugin plus zip as a CI artifact.main.js, generates GitHub artifact attestations, and publishes a GitHub Release with main.js, manifest.json, and styles.css. The zip stays in CI artifacts and local builds; it is not attached to the release.The release tag must exactly match manifest.version; do not prefix it with v.
node scripts/verify-version.mjs 0.1.2
git tag -a 0.1.2 -m "0.1.2"
git push origin 0.1.2
Obsidian now accepts submissions at community.obsidian.md, not through a pull request to obsidian-releases. See the official Submit your plugin guide.
Before submitting:
README.md, LICENSE, and manifest.json at the root.obsidian, and should match the plugin folder name.version must use x.y.z, and must match package.json, versions.json, and the GitHub Release tag.main.js, manifest.json, and styles.css.isDesktopOnly must be true.To submit:
After approval, users can install the plugin from Settings → Community plugins → Browse. Future updates only require a new GitHub Release.
Official references:
MIT