yakivmospan / github-wikito-converter

Generate HTML & PDF documentation from Github wiki or any other markdown-based wiki.
Other
293 stars 52 forks source link

Problem converting Ethereum wiki #31

Closed fmmarzoa closed 5 years ago

fmmarzoa commented 5 years ago

Got this wiki cloned on wiki.wiki folder:

https://github.com/ethereum/wiki.wiki.git

Tried

$ gwtc wiki.wiki

Crashes with Unhandled rejection Error: Unknown language: "solidity" Please report this to https://github.com/markedjs/marked. at Object.highlight (/usr/local/lib/node_modules/github-wikito-converter/node_modules/highlight.js/lib/highlight.js:494:13) at Renderer.mainRenderer.code (/usr/local/lib/node_modules/github-wikito-converter/dist/markdown.js:34:79) at Parser.tok (/usr/local/lib/node_modules/github-wikito-converter/node_modules/marked/lib/marked.js:1058:28) at Parser.parse (/usr/local/lib/node_modules/github-wikito-converter/node_modules/marked/lib/marked.js:1003:17) at Function.Parser.parse (/usr/local/lib/node_modules/github-wikito-converter/node_modules/marked/lib/marked.js:985:17) at marked (/usr/local/lib/node_modules/github-wikito-converter/node_modules/marked/lib/marked.js:1322:19) at Markdown.convertMarkdownString (/usr/local/lib/node_modules/github-wikito-converter/dist/markdown.js:109:14) at Markdown.convertMarkdownFile (/usr/local/lib/node_modules/github-wikito-converter/dist/markdown.js:116:19) at WikiConverter. (/usr/local/lib/node_modules/github-wikito-converter/dist/wiki-converter.js:87:41) at Array.forEach () at WikiConverter.computePages (/usr/local/lib/node_modules/github-wikito-converter/dist/wiki-converter.js:83:27) at WikiConverter.getPages (/usr/local/lib/node_modules/github-wikito-converter/dist/wiki-converter.js:96:14) at HtmlWriter.write (/usr/local/lib/node_modules/github-wikito-converter/dist/html-writer.js:33:34) at WikiConverter. (/usr/local/lib/node_modules/github-wikito-converter/dist/wiki-converter.js:60:43) at tryCatcher (/usr/local/lib/node_modules/github-wikito-converter/node_modules/bluebird/js/main/util.js:26:23) at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/github-wikito-converter/node_modules/bluebird/js/main/promise.js:510:31)

yakivmospan commented 5 years ago

Thank you for the contribution, I will check it out and get back to you in the nearest future.

yakivmospan commented 5 years ago

Meanwhile, check out this one https://github.com/yakivmospan/github-wikito-converter/issues/21 and https://github.com/yakivmospan/github-wikito-converter/issues/17

See if your cloned wiki doesn't have the same issue.

yakivmospan commented 5 years ago

It actually has a similar issue, from the log I can see, that somewhere in the wiki, you are using solidity language mark, that is unknown for marked, the tool that is used to highlight the code.

Changing solidity to something else (such as java, text, etc.) can temporarily solve this issue.

fmmarzoa commented 5 years ago

It's not my wiki actually. I just wanted to read it in my Kindle. 🙂

On Fri, 12 Oct 2018 at 00:21, Yakiv Mospan notifications@github.com wrote:

It actually has a similar issue, from the log I can see, that somewhere in the wiki, you are using solidity language mark, that is unknown for marked https://github.com/markedjs/marked, the tool that is used to highlight the code.

Changing solidity to something else (such as java, text, etc.) can temporarily solve this issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yakivmospan/github-wikito-converter/issues/31#issuecomment-429139323, or mute the thread https://github.com/notifications/unsubscribe-auth/AGEsgZowXACOiZT1IcnF6RMp0Cobcc-bks5uj8R9gaJpZM4XYQLS .

-- Fran Marzoa

yakivmospan commented 5 years ago

Amazing idea:) If you still want to reas it on kindle, download and replace each of those in each of the files manually. Thants a dirty workeround for now

zakaluka commented 5 years ago

Could something like this be implemented temporarily? https://github.com/markedjs/marked/issues/810#issuecomment-255519584

yakivmospan commented 5 years ago

@zakaluka thanks, currently we have this :

this.mainRenderer.code = function(code, lang) {
      code = lang === undefined ? highlight.highlightAuto(code) : highlight
        .highlight(lang, code)
      return `<pre class="hljs">${code.value}</pre>`
    }

But we can also try to specify that options. Worth to try it.

yakivmospan commented 5 years ago

Fixed in https://github.com/yakivmospan/github-wikito-converter/releases/tag/1.5.1. Now we are doing :

    this.mainRenderer.code = function(code, lang) {
      if (lang && highlight.getLanguage(lang)) {
        code = highlight.highlight(lang, code, true);
      } else {
        code = highlight.highlightAuto(code);
      }
      return `<pre class="hljs">${code.value}</pre>`
    }