Skip to content

v5 history router crashes because HTML5History does not implement normalize() #2700

@Niek

Description

@Niek

Repro

Using the current v5 pre-release (docsify@5.0.0-rc.4), configure Docsify with:

<script>
  window.$docsify = {
    routerMode: 'history',
  }
</script>
<script src="//cdn.jsdelivr.net/npm/docsify@5.0.0-rc.4/dist/docsify.min.js"></script>

Then load the page.

Actual result

Docsify crashes during startup with:

Uncaught Error: Subclass should implement

In the distributed bundle this comes from the abstract History.normalize() implementation being called during Router.updateRender().

Expected result

routerMode: 'history' should initialize and render normally.

Why this happens

The router code currently assumes every router implements normalize():

  • src/core/router/index.js calls this.router?.normalize() inside updateRender().
  • src/core/router/history/hash.js implements normalize().
  • src/core/router/history/html5.js does not implement normalize().
  • src/core/router/history/base.js defines normalize() as an abstract method that throws Error('Subclass should implement').

I also checked the current develop branch sources on March 25, 2026, and the same mismatch is still present there.

Notes

I hit this while migrating a Docsify site from v4 to v5. A local workaround was to patch updateRender() / router.normalize to a no-op for history mode, after which history routing worked as expected, including direct deep links.

Metadata

Metadata

Assignees

Labels

bugconfirmed as a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions