docsifyjs / docsify

🃏 A magical documentation site generator.
https://docsify.js.org
MIT License
27.57k stars 5.67k forks source link

Embed files does not work #1005

Closed gigaga closed 3 years ago

gigaga commented 4 years ago

Bug Report

By using the last release of docsify (from CDN https://cdn.jsdelivr.net/npm/docsify@4), the feature Embed files does not work.

Steps to reproduce

From the code below :

[filename](./test.md ":include")

What is current behaviour

The render will be a link name filename.

What is the expected behaviour

The test.md content should be rendered directly (embedded).

Other relevant information

anikethsaha commented 4 years ago

is it same for prev version ?

gigaga commented 4 years ago

I tried with :

:(

anikethsaha commented 4 years ago

thanks, I will check it soon 👍

gigaga commented 4 years ago

Also, from @4.8.0, embed file feature works, however, from a specific plugin, I'd like to change content so, from

$docsify.plugins = [].concat(install, $docsify.plugins);

// Install a specific plugin to force current sidebar item active into collapse state
function install(hook, vm) {
  hook.beforeEach(function(content) {
    // Invoked each time before parsing the Markdown file.
    // ...
    console.log(content)
    return content;
  });
}

content is only the content of main MD file. I'm not able to change content of an embed file :(.

Thanks a lot for your feedback!

anikethsaha commented 4 years ago

Yes it can't read the embedded file's code

gigaga commented 4 years ago

No workaround is possible? Thanks

anikethsaha commented 4 years ago

i cant say that right now, I need to check and try. I am not sure how markedjs process embedded files that's why. Feel free to investigate 👍

stratosgear commented 4 years ago

what a coincidence! I just got hit by it right now!

Try with single quotes, like in: [filename](./test.md ':include').

Works for me!

anikethsaha commented 4 years ago

what a coincidence! I just got hit by it right now!

Try with single quotes, like in: [filename](./test.md ':include').

Works for me!

@gigaga can you try this

gigaga commented 4 years ago

Hello @anikethsaha

Like you, it's work by using single quotes!

Thanks!

gigaga commented 4 years ago

About embedded files processing, I can do what I want by override markdown function.

Thanks again :)

anikethsaha commented 4 years ago

Yea you can use the plugin hook to get into the core op.

trusktr commented 3 years ago

Will be fixed by #1598