Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docsify can not render an embedded #1499

Closed
fgaule opened this issue Feb 8, 2021 · 4 comments
Closed

Docsify can not render an embedded #1499

fgaule opened this issue Feb 8, 2021 · 4 comments

Comments

@fgaule
Copy link

fgaule commented Feb 8, 2021

Bug Report

Steps to reproduce

  1. Import tab plugin
  2. Create a .md file with a tab
  3. Import that .md into any other .m using the embedded feature

What is current behaviour

When you embedded a .md it is not being rendered.

What is the expected behaviour

When you embedded a .md should be rendered. In this case, tabs should be displayed as when they are inline.

Other relevant information

  • [ X] Bug does still occur when all/other plugins are disabled?

  • Your OS: iOS 10.15.7 (19H2)

  • Node.js version: v14.6.0

  • npm/yarn version: npm 6.14.7

  • Browser version: Chrome Version 88.0.4324.146 (Official Build) (x86_64)

  • Docsify version: docsify@4

  • Docsify plugins: docsify-tabs@1

Related issue

Please create a reproducible sandbox

https://github.com/fgaule/docsfy-embedded-not-rendering/tree/main/docs

Mention the docsify version in which this bug was not present (if any)

@jhildenbiddle
Copy link
Member

From the linked issue originally filed in the docsify-tabs repo:

Unfortunately, this is a limitation of docsify's plugin system and not something that docsify-tabs can easily resolve. The short explanation is that docsify's plugin system functions at the page level, so there is no "hook" to leverage for processing content that is loaded via an embed.

Today we have beforeEach, afterEach, and doneEach plugin hooks, all of which operate on the page-level:

function(hook, vm) {
  hook.beforeEach(function(content, next) {
    // Invoked each time before parsing the Markdown file.
    // ...
    return content;
  });

  hook.afterEach(function(html, next) {
    // Invoked each time after the Markdown file is parsed.
    // ...
    return html;
  });

  hook.doneEach(function() {
    // Invoked each time after the data is fully loaded, no arguments,
    // ...
  });
}

Offering markdown-specific plugin hooks (e.g. beforeMarkdown and afterMarkdown) would give docsify the ability to create a separate, under-the-hood markdown-specific plugin pipeline that could be applied to all markdown content:

function(hook, vm) {
  hook.beforeEach(function() {
    // Invoked before loading new page content
    // Useful for cleanup/teardown
    // ...
  });

  hook.beforeMarkdown(function(md, next) {
    // Invoked before parsing Markdown
    // ...
    return md;
  });

  hook.afterMarkdown(function(html, next) {
    // Invoked after parsing Markdown
    // ...
    return html;
  });

  hook.doneEach(function() {
    // Invoked each time after the data is fully loaded, no arguments,
    // ...
  });
}

@ayjw
Copy link

ayjw commented Sep 22, 2021

I also encounter this problem, want to know how to solve

@Hyddan
Copy link

Hyddan commented Oct 12, 2023

We also ran into this issue with docsify-tabs and wrote our own plugin for tabs: useless-docsify-tabs. It doesn't have as many features as docsify-tabs but it does work when embedded.

@jhildenbiddle
Copy link
Member

Marking as duplicate of more appropriately named issue: #2373

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants