docsify-chat icon indicating copy to clipboard operation
docsify-chat copied to clipboard

config in window.$docsify doesn't take effect

Open Kevin-WongCHN opened this issue 9 months ago • 6 comments

annotation can take effect, for instance:

.

but config in window.$docsify doesn't take effect, for instance chat: { // chat panel title title: "Dialog", // set avatar url users: [ { nickname: "Yuki", avatar: "" }, { nickname: "Robot", avatar: "" }, ], },

Kevin-WongCHN avatar Apr 16 '25 05:04 Kevin-WongCHN

Can you provide more detailed information? such as full config and page codes, as well as markdown content or console log. (。・∀・)ノ゙

xueelf avatar Apr 16 '25 10:04 xueelf

the following is what I wrote in index.html

window.$docsify = {
        name: "",
        repo: "",
        loadSidebar: true,
        subMaxLevel: 3,
        auto2top: true,
        chat: {
          os: "mac",
          title: "title",
          // set avatar url
          users: [
          { nickname: "Yuki", avatar: "" },
          { nickname: "Robot", avatar: "" },
          ],
        },
      };

but as the picture show, the config didn't take effect

Image

the js file is fetched from jsdelivr, so version of both docsify and docsify-chat depend on js file stored in jsdelivr.

  <script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
  <script src="//cdn.jsdelivr.net/npm/docsify-chat/lib/docsify-chat.min.js"></script>

however, using annotation as config did take effect.

<!-- chat:start -->
<!-- self:Yuki -->
#### **Yuki**
hello
#### **Robot**
hello world
<!-- chat:end -->
<!-- tabs:start -->

in the code i set self:Yuki, and it works

Image

Kevin-WongCHN avatar Apr 16 '25 10:04 Kevin-WongCHN

Hey, I ran the code snippet you provided locally and successfully reproduced the issue you described, but this isn't a bug in the library itself.

I noticed you set the loadSidebar property to true in the config. According to the official documentation, when enabling loadSidebar, you need to create a corresponding _sidebar.md file in your documentation root directory. Alternatively, you can directly specify a custom MD file like loadSidebar: 'summary.md'.

After properly configuring the sidebar, the chat panel should render successfully on the page. The earlier content rendering issue was specifically caused by the sidebar not being loaded correctly.

By the way, I noticed the title and os properties in your code snippet weren't taking effect. I've fixed this issue, and you can now view the changes after clearing the CDN cache and refreshing the page. ( •̀ ω •́ )✧

xueelf avatar Apr 16 '25 11:04 xueelf

The CDN synchronization may take several hours. You can check the docsify-chat version via $docsify.chat.version. When it displays 1.0.2, the functionality will work properly.

xueelf avatar Apr 16 '25 11:04 xueelf

Thanks a lot!!!!! When the CDN refreshes, I will let you know if it works or have other bugs. ( •̀ ω •́ )✧

Kevin-WongCHN avatar Apr 16 '25 11:04 Kevin-WongCHN

some advice: Allow other configurations to be set via annotations when needed in specific scenarios. 😊

Kevin-WongCHN avatar Apr 16 '25 11:04 Kevin-WongCHN