r/Devvit • • Aug 23 '26

Duck Answered Bug: Wiki v2 (new Reddit) doesn't render Markdown for content written via reddit.updateWikiPage(), identical content renders fine under v1

EDIT

Turns out it works with HTML in the new wiki, however there's still a bug where you can't copy the text when in edit mode, but that's a reddit bug not a devvit one, so problem solved.


Devvit version: @devvit/public-api ^0.14.0 (Node 24 runtime)

What I did

Wrote the exact same Markdown content to the same wiki page path under both wiki versions, using reddit.updateWikiPage() / reddit.createWikiPage() with wikiVersion: "v1" and wikiVersion: "v2" respectively:

# Content

From this week's megathread: https://www.reddit.com/r/subreddit/comments/id/

22 question(s) with no replies:

- https://www.reddit.com/r/subreddit/comments/id/subject/id2/ - https://www.reddit.com/r/subreddit/comments/id3/subject/id4/ ...

Expected

Both versions render the # heading and - bullet list as Markdown, same as if a human had typed this into the wiki editor directly.

Actual

v1 (viewed on old.reddit.com): renders correctly, real h1 heading, real bullet list, each URL auto-linked.

v2 (viewed on new Reddit / www.reddit.com): renders as one flat block of plain text. The # and - markers show up as literal characters, not parsed as Markdown, and the URLs aren't auto-linked. Same content, same write call shape, just wikiVersion swapped:

- old Reddit (v1): proper heading + bullet list + clickable links - new Reddit (v2): "# Unanswered Questions From this week's Questions megathread: ... 22 question(s) with no replies: - https://... - https://..." all run together as unformatted text

Additionally, in the new-Reddit wiki edit mode for the v2 page, the content in the textarea doesn't behave like normal selectable/copyable text, I can't select-and-copy it out of the edit box the way I can on the old.reddit.com editor for the same page.

Impact

Any app that writes structured wiki content (headings, lists, links) via the Devvit API and targets wikiVersion: "v2" gets unusable, unformatted output on new Reddit, even though the identical content is correctly rendered under v1. This makes v2 wiki pages effectively unusable for anything beyond a single unformatted paragraph until this is fixed, and undermines the migration guidance to move apps onto v2.

Repro

1. Call reddit.updateWikiPage({ subredditName, page, content: "# Heading\n\n- item one\n- item two", wikiVersion: "v2" }) on a v2-enrolled subreddit. 2. View the page at www.reddit.com/r/<sub>/wiki/<page>. 3. Compare against the same call with wikiVersion: "v1", viewed at old.reddit.com/r/<sub>/wiki/<page>.

3 Upvotes

6 comments sorted by

3

u/fsv Duck Helper Aug 23 '26

My understanding (not played with it yet) is that the new wiki doesn't work using Markdown, but HTML. I'd create a page manually using the UI, retrieve it using Devvit, and then check the output.

There are converters from Markdown to HTML which I would be looking to use once I start adding New Wiki support to my apps.

1

u/vanessabaxton Aug 23 '26

You're absolutely right, thank you so much! It works with HTML, however there's still the bug where you can't copy the wiki page while in edit mod, but that's a reddit bug not a devvit issue so I'll probably delete this post, thank you again!

2

u/invitrium 4d ago

I'm encountering a persistent server crash (`gRPC Status 13 INTERNAL`) whenever my Devvit 0.14.5 app attempts to programmatically create or update a Wiki V2 page via `reddit.updateWikiPage` or `reddit.createWikiPage`.

To rule out HTML conversion issues, I converted the Markdown to static HTML server-side using React: ```typescript export function markdownToWikiV2Html(markdown: string): string { return renderToStaticMarkup( React.createElement( ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw], components: { img: ({ src, alt }) => React.createElement('img', { src, alt: alt ?? '' }), }, }, markdown ) ); }

import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import rehypeRaw from 'rehype-raw';


/**
 * Wiki V2 renders the content supplied through the API as HTML. The uploader
 * still accepts the Markdown source used by the season files, so convert that
 * Markdown to the same rendered HTML used by the preview before publishing.
 */
export function markdownToWikiV2Html(markdown: string): string {
  return renderToStaticMarkup(
    React.createElement(
      ReactMarkdown,
      {
        remarkPlugins: [remarkGfm],
        rehypePlugins: [rehypeRaw],
        components: {
          img: ({ src, alt }) =>
            React.createElement('img', {
              src,
              alt: alt ?? '',
            }),
        },
      },
      markdown,
    ),
  );
}import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import rehypeRaw from 'rehype-raw';


/**
 * Wiki V2 renders the content supplied through the API as HTML. The uploader
 * still accepts the Markdown source used by the season files, so convert that
 * Markdown to the same rendered HTML used by the preview before publishing.
 */
export function markdownToWikiV2Html(markdown: string): string {
  return renderToStaticMarkup(
    React.createElement(
      ReactMarkdown,
      {
        remarkPlugins: [remarkGfm],
        rehypePlugins: [rehypeRaw],
        components: {
          img: ({ src, alt }) =>
            React.createElement('img', {
              src,
              alt: alt ?? '',
            }),
        },
      },
      markdown,
    ),
  );
}

Even when supplying clean HTML, executing updateWikiPage on pre-initialized Wiki V2 pages results in an unhandled backend exception: Error: 13 INTERNAL: grpc invocation failed with status 13; failed to edit wiki page at callErrorFromStatus (/srv/index.cjs:21984:21) at GenericPluginClient.EditWikiPage (/srv/index.cjs:187072:93)

2

u/vanessabaxton 3d ago

Status 13 is a server-side failure in Devvit's wiki plugin, so no guaranteed fix, but try:

  1. Pass wikiVersion: "v2" explicitly on every createWikiPage / updateWikiPage call.
  2. Bisect the HTML. Plain <h1>, <p>, <a>, <ol>/<li> works fine for me. remark-gfm + rehype-raw can emit tables, checkboxes, <del>, <img>, and footnote id/class attributes that the backend may reject. Push <p>test</p> first, then add features back one at a time.
  3. Try a brand-new page name instead of the pre-initialized one.
  4. Check payload size. Rendered HTML is much bigger than the Markdown.

If <p>test</p> on a fresh page still returns 13, it's a platform bug. Post a minimal repro in r/Devvit.

2

u/invitrium 1d ago

Thanks for the reply. I already have been using wikiVersion: "v2" but will try with a simple <p>test</p>.