Molunerfinn / hexo-theme-melody

:musical_keyboard:A simple & beautiful & fast theme for Hexo.
https://molunerfinn.com
Other
1.59k stars 212 forks source link

[Issues] hljs is not defined, Reveal.initialize({dependencies:[]}) has been deprecated as of reveal.js 4.0.0. #320

Closed ghost closed 3 years ago

ghost commented 3 years ago

I want to create a new issue

Melody Information

Melody Version: 1.9.0

Platform: macOS 10.13.6 (High Sierra)

Browser: Firefox

Expected behavior

运行hexo服务后,使用幻灯片插件显示正确内容。

translator

After running the hexo service, use the slideshow plugin to display the correct content.

Actual behavior

运行hexo服务后,使用幻灯片插件未显示内容。 Firefox -> Web控制台,显示 Uncaught ReferenceError: hljs is not defined

translator

After running the hexo service, the content is not displayed using the slideshow plugin. Firefox -> Web console, display Uncaught ReferenceError: hljs is not defined.

Screenshots

1

Steps to reproduce the behavior

$ cd src/hexo
$ hexo init
$ hexo new draft hello-slides
$ vi source/__drafts/hello-slides
---
title: hello-slides
tags: 默认标签
categories: 默认分类
date: 2020-12-28 12:15:41
layout: slides
---

### 这是一份草稿

### hexo-theme-melody <small>v1.5</small>
<!-- .slide: data-background="#49B1F5" -->

Supports iframe & slides. You can use a layout called `slides` to enabled the slides layout.

Also you can add a `iframe` front-matter with the `slides` layout in your `md` file to enable the iframe page.

### Steps
<!-- .slide: data-transition="concave" data-background="#C7916B" -->

#### 1. Add a slides page

// ......

==

// ......

===

#### 2. Add the layout type
<!-- .slide: data-transition="fade" data-background="#00C4B6" -->

// ......

$ # [hexo-theme-melody#218](https://github.com/Molunerfinn/hexo-theme-melody/issues/218)
$ # 尝试修改timeout为10000,依然报错。
$ # translator
$ # >attempt to modify the timeout of 10,000, is still an error.
$ hexo clean && hexo s --draft

Feature Request

参考 Docs: reveal plugins 进行如下修改后内容正常显示:

translator

Refer to Docs: reveal plugins and make the following modifications to display the content normally:

node_modules/hexo-theme-melody/layout/includes/slide/script.pug

......
script(src=url_for("https://cdn.jsdelivr.net/npm/reveal.js@latest/plugin/markdown/markdown.js"))
script(src=url_for("https://cdn.jsdelivr.net/npm/reveal.js@latest/plugin/highlight/highlight.js"))
......
    plugins: [
......
    // Markdown
    RevealMarkdown,
    // Highlight
    RevealHighlight,
    ],
    dependencies: [
      //- { src: 'https://cdn.jsdelivr.net/npm/reveal.js@latest/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
      // Syntax highlight for <code> elements
      //- { src: 'https://cdn.jsdelivr.net/npm/reveal.js@latest/plugin/highlight/highlight.js', async: true, callback: function() {
      //-   // issue #218
      //-   setTimeout(function () {
      //-     hljs.initHighlighting();
      //-   }, 0)
      //- } },
    ]
  });

script.
  console.log(
    "plugins search: ", Reveal.hasPlugin( 'search' ),
    ", plugins markdown: ", Reveal.hasPlugin( 'markdown' ),
    ", plugins highlight: ", Reveal.hasPlugin( 'highlight' ),
  );

Screenshots

2
Molunerfinn commented 3 years ago

has already fixed by this commit: https://github.com/Molunerfinn/hexo-theme-melody/commit/7b4993f2525a2e8e9494d6402c89c1a10f51a5a1

I'll release a subversion ASAP

ghost commented 3 years ago

thank's for reply @Molunerfinn :)