#16348·joplin

Markdown & HTML Exporters fail to convert joplin:// URI links to relative paths during export

Author: Pcmhacker-heroCreated Aug 29, 2026Updated Sep 28, 2026
Labelsstale

Operating system

macOS, Windows, Linux (All platforms affected)

Joplin version

3.3.x / 3.4.x-dev (Tested on latest dev branch commit b7beb0bd060dd2f9b287521d826ea46127839def)

Desktop version info

Joplin 3.3.12 (dev, darwin)
Client ID: c77e23a9b3d0473a8ef56123456789ab
Sync Version: 3
Profile Version: 47
Keychain Supported: true

Executive Summary

When exporting notes from Joplin using any of the standard export formats:

  • MD - Markdown
  • MD - Markdown + Front Matter
  • HTML - HTML directory
  • HTML - HTML file

Internal note links and attachment/resource links that use the standard joplin://<id> URI scheme (generated via Joplin's context menu, copy markdown link, or plugin integrations) are never transformed into relative filesystem paths.

They are exported as raw joplin://<id> URLs in the resulting .md and .html files. As a consequence:

  1. When exported Markdown files are opened in external tools (Obsidian, VS Code, Typora, Logseq, GitHub), all cross-note links and media references fail to resolve.
  2. When exported HTML files are opened in a web browser, clicking on note links or viewing attachments fails because browsers cannot resolve internal joplin:// application protocols to local files.

Visual Reproduction Proof

Joplin Bug Reproduction


Steps to Reproduce

  1. In Joplin Desktop, create two notes in any notebook:
    • Target Note: Title: "01. Database Plan"
    • Source Note: Title: "02. Overview & Links", with content referencing the target note and an image attachment using standard joplin:// links:
      markdown
      # System Overview
      
      Link created via Context Menu / Copy Markdown Link:
      [Database Plan](joplin://7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d)
      
      Link created via Drag & Drop / Legacy format:
      ![Architecture Diagram](:/f0e1d2c3b4a5968778695a4b3c2d1e0f)
  2. Navigate to the top menu: File → Export All (or right-click the notebook → Export).
  3. Select either MD - Markdown, MD - Markdown + Front Matter, or HTML - HTML directory.
  4. Choose an export destination directory and complete the export.
  5. Open the exported markdown file in an external editor (or the exported .html file in a browser).
  6. Inspect the generated link targets.

❌ Current / Actual Behaviour

The exported file retains the unparsed internal Joplin URI:

markdown
[Database Plan](joplin://7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d)
  • In Obsidian / VS Code: Clicking [Database Plan](joplin://...) does not navigate to ../Project Specs/01. Database Plan.md.
  • In HTML export: Browsers cannot locate the linked document or asset.

✅ Expected Behaviour

During export, all internal note and resource references (whether written using legacy :/<id> syntax or joplin://<id> syntax) should be translated into relative filesystem paths matching the exported directory tree:

markdown
[Database Plan](../Project%20Specs/01.%20Database%20Plan.md)
![Architecture Diagram](../_resources/photo.jpg)

Technical Deep Dive & Root Cause Analysis

1. Dual Protocol Support in Joplin

Joplin natively recognizes two internal protocol schemes for note/resource links:

  1. Legacy colon-slash: :/0123456789abcdef0123456789abcdef
  2. Modern URI: joplin://0123456789abcdef0123456789abcdef

In packages/lib/urlUtils.ts, both schemes are extracted:

typescript
const resourceRegex = /^(joplin:\/\/|:\/)([0-9a-zA-Z]{32})(|#[^\s]*)(|\s".*?")$/;

Because of this, Note.linkedItemIds(), Note.linkedResourceIds(), and Note.linkedNoteIds() successfully detect and collect the linked item IDs.


2. Hardcoded Regular Expression in Exporter Services

When the exporters iterate over the discovered item IDs to replace internal identifiers with relative filesystem paths, they hardcode new RegExp(':/' + id, 'g') and omit the joplin:// scheme.

Affected Files:

  1. packages/lib/services/interop/InteropService_Exporter_Md.ts:L78:

    typescript
    private async replaceItemIdsByRelativePaths_(noteBody: string, linkedItemIds: string[], paths: Record<string, string>, fn_createRelativePath: (path: string)=> string) {
        let newBody = noteBody;
    
        for (let i = 0; i < linkedItemIds.length; i++) {
            const id = linkedItemIds[i];
            const itemPath = fn_createRelativePath(paths[id]);
            // ⚠️ Only matches ":/<id>" - completely ignores "joplin://<id>"
            newBody = newBody.replace(new RegExp(`:/${id}`, 'g'), markdownUtils.escapeLinkUrl(itemPath));
        }
    
        return newBody;
    }
  2. packages/lib/services/interop/InteropService_Exporter_Html.ts:L96:

    typescript
    private async processNoteResources_(item: NoteEntity) {
        // ...
        for (let i = 0; i < linkedResourceIds.length; i++) {
            const id = linkedResourceIds[i];
            // ...
            const resourceContent = `${relativePath ? `${relativePath}/` : ''}_resources/${basename(resourcePaths[id])}`;
            // ⚠️ Only matches ":/<id>"
            newBody = newBody.replace(new RegExp(`:/${id}`, 'g'), resourceContent);
        }
        return newBody;
    }
  3. packages/lib/models/Note.ts:L241:

    typescript
    public static async replaceResourceInternalToExternalLinks(body: string, options: { useAbsolutePaths?: boolean } = null) {
        // ...
        for (let i = 0; i < resourceIds.length; i++) {
            const id = resourceIds[i];
            // ...
            // ⚠️ Only matches ":/<id>"
            body = body.replace(new RegExp(`:/${id}`, 'gi'), markdownUtils.escapeLinkUrl(resourcePath));
        }
        return body;
    }

️ Proposed Solution & Git Diff

Update the regular expressions in the exporter routines to match both (joplin://|:/) prefixes:

diff
--- a/packages/lib/services/interop/InteropService_Exporter_Md.ts
+++ b/packages/lib/services/interop/InteropService_Exporter_Md.ts
@@ -75,7 +75,7 @@ export default class InteropService_Exporter_Md extends InteropService_Exporter_
 		for (let i = 0; i < linkedItemIds.length; i++) {
 			const id = linkedItemIds[i];
 			const itemPath = fn_createRelativePath(paths[id]);
-			newBody = newBody.replace(new RegExp(`:/${id}`, 'g'), markdownUtils.escapeLinkUrl(itemPath));
+			newBody = newBody.replace(new RegExp(`(joplin://|:/)${id}`, 'g'), markdownUtils.escapeLinkUrl(itemPath));
 		}

--- a/packages/lib/services/interop/InteropService_Exporter_Html.ts
+++ b/packages/lib/services/interop/InteropService_Exporter_Html.ts
@@ -93,7 +93,7 @@ export default class InteropService_Exporter_Html extends InteropService_Exporte
 				continue;
 			}
 			const resourceContent = `${relativePath ? `${relativePath}/` : ''}_resources/${basename(resourcePaths[id])}`;
-			newBody = newBody.replace(new RegExp(`:/${id}`, 'g'), resourceContent);
+			newBody = newBody.replace(new RegExp(`(joplin://|:/)${id}`, 'g'), resourceContent);
 		}

--- a/packages/lib/models/Note.ts
+++ b/packages/lib/models/Note.ts
@@ -238,7 +238,7 @@ export default class Note extends BaseItem {
 			// needed for other resources since they are simple links.
 			const timestampParam = isImage ? `?t=${resource.updated_time}` : '';
 			const resourcePath = options.useAbsolutePaths ? toFileProtocolPath(Resource.fullPath(resource)) + timestampParam : Resource.relativePath(resource);
-			body = body.replace(new RegExp(`:/${id}`, 'gi'), markdownUtils.escapeLinkUrl(resourcePath));
+			body = body.replace(new RegExp(`(joplin://|:/)${id}`, 'gi'), markdownUtils.escapeLinkUrl(resourcePath));
 		}

Testing Suggestion

Add automated test cases to packages/lib/services/interop/InteropService_Exporter_Md.test.ts:

typescript
it('should replace joplin:// note and resource links with relative paths during markdown export', (async () => {
    const exporter = new InteropService_Exporter_Md();
    await exporter.init(exportDir());

    const folder = await Folder.save({ title: 'folder1' });
    const targetNote = await Note.save({ title: 'target', parent_id: folder.id });
    const sourceNote = await Note.save({
        title: 'source',
        parent_id: folder.id,
        body: `[Link to target](joplin://${targetNote.id})`,
    });

    const { items: itemsToExport, queue } = createExportItems();
    queue(BaseModel.TYPE_FOLDER, folder.id);
    queue(BaseModel.TYPE_NOTE, targetNote);
    queue(BaseModel.TYPE_NOTE, sourceNote);

    await exporter.prepareForProcessingItemType(BaseModel.TYPE_NOTE, itemsToExport);
    await exporter.processItem(Note.modelType(), sourceNote);

    const exportedContent = await shim.fsDriver().readFile(`${exportDir()}/${exporter.context().notePaths[sourceNote.id]}`);
    expect(exportedContent).toContain('](target.md)');
    expect(exportedContent).not.toContain(`joplin://${targetNote.id}`);
}));

Impact

  • Scope: Affects all platforms (Desktop, CLI, Mobile exports).
  • Severity: High for data export and portability workflows. Users sharing exported Markdown/HTML vaults with colleagues or migrating notes to Obsidian/GitHub experience broken links throughout their documents whenever links were created via Joplin's modern URI format.