Skip to content

Fetch Markdown Block Content Through The Backend - #261

Open
JurajSkakala wants to merge 12 commits into
masterfrom
feat/fetch-markdown-content-from-backend
Open

Fetch Markdown Block Content Through The Backend#261
JurajSkakala wants to merge 12 commits into
masterfrom
feat/fetch-markdown-content-from-backend

Conversation

@JurajSkakala

@JurajSkakala JurajSkakala commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fixes RCT-9896

The markdown block now fetches content through the Supernova backend instead of downloading remote files directly.

Changes

  • page_block_custom_markdown.pr calls the new Pulsar function ds.markdownFromUrl(url) (backend POST /markdown/from-url with forceUpdate: false) instead of getNetworkData()

Blocked by

@JurajSkakala JurajSkakala self-assigned this Aug 12, 2026

@honzatmn honzatmn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. Just commenting without explicit approve, so we don't accidentally merge it to master before backend is on prod too.

let html = converter.makeHtml(markdown)
return `<div class="markdown">${html}</div>`
let html = converter.makeHtml(markdown);
return `<div class="markdown">${sanitizeHtml(html, MARKDOWN_SANITIZE_OPTIONS)}</div>`;

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.

Added sanitization of HTML for rendering. Same lib, logic and rules should be applied also in cloud editor markdown rendering

@JurajSkakala
JurajSkakala requested a review from mathevs August 19, 2026 09:16
@JurajSkakala

Copy link
Copy Markdown
Contributor Author

Latest changes in 14ec539:

  • if documentation env value is Live -> re-fetch markdowns and store them in DB. Return latest content.
  • if documentation env value is not Live (Preview / null) -> only fetch remote content but don't update it in DB

Juraj Skakala and others added 4 commits August 21, 2026 15:50
The shim covered sanitize-html's entities dependency, which is gone since
the switch to rehype-sanitize; nothing in the bundle references a global
atob anymore (js-base64 carries its own polyfill).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@JurajSkakala
JurajSkakala marked this pull request as ready for review August 25, 2026 04:49
@JurajSkakala

Copy link
Copy Markdown
Contributor Author

Latest changes:

  • 91a89da
    • we change the markdown to HTML pipeline in editor. To preserve consistency we changed it also for published doc exporter.
    • e44dd89 - removed some leftovers that are not needed anymore

src: ['http', 'https'],
},
// Keep ids as authored, the rendered page is not user-controlled enough to need clobbering
clobber: [],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isn't it? like user can add whatever to the markdown

{* Download markdown data *}
{[ let markdownData = getNetworkData(url, settings) /]}
{[ if isNonEmptyString(markdownData) ]}
{[ if isNonEmptyString(markdownData.content) ]}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this might fail if ds.markdownFromUrl returns null

* (packages/editor/src/utils/markdown/markdownSanitizeSchema.ts) so the editor
* preview and published docs sanitize identically. Update both together.
*/
const MARKDOWN_SANITIZE_SCHEMA: SanitizeSchema = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since we are not extending but replacing default schema, shouldn't we include strip for "script" and "style"?

Comment thread exporter.json
"source_dir": "src",
"assets_dir": "assets",
"version": "5.6.4",
"version": "5.7.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we need to keep the markdown token here since it won't be used anymore ? If it is migrated and it should not be provided in the settings anymore then we might remove it from here 🤔 can be separate PR

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.

3 participants