rstacruz / flatdoc

Build sites fast from Markdown

Home Page:http://ricostacruz.com/flatdoc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flatdoc shows only blank page

BorisBrock opened this issue · comments

To get started with flatdoc I used the template.html file together with the Readme.md. I changed the code in template.html to the following:

<script>
    Flatdoc.run({
      fetcher: Flatdoc.file('Readme.md')
    });
  </script>


But when I open the template.html in a browser (Firefox ESR 52) all I get is a blank flatdoc page. No contents from the Readme.md are shown. Am I missing something here?

PS:
In the Firefox web console there are three erros:

XML Parsing Error: syntax error
Location: file:///C:/Users/visbbr/Desktop/Doc/Readme.md
Line Number 1, Column 1: Readme.md:1:1

XML Parsing Error: syntax error
Location: file:///C:/Users/visbbr/Desktop/Doc/template.html
Line Number 1, Column 1: template.html:1:1

[Flatdoc] fetching Markdown data failed. Object { readyState: 4, getResponseHeader: .ajax/N.getResponseHeader(), getAllResponseHeaders: .ajax/N.getAllResponseHeaders(), setRequestHeader: .ajax/N.setRequestHeader(), overrideMimeType: .ajax/N.overrideMimeType(), statusCode: .ajax/N.statusCode(), abort: .ajax/N.abort(), state: .Deferred/r.state(), always: .Deferred/r.always(), then: .Deferred/r.then(), 11 more… }

I believe the site has to be run from a server - you can't just open up the html file.

You can quickly create a static site using something like Python or Node. This SO post might help: https://stackoverflow.com/questions/12905426/what-is-a-faster-alternative-to-pythons-http-server-or-simplehttpserver

@harvzor Buddy, HTML files can be opened in any browser. no server required. unless the file extension is .php / .rb / .py etc.

by the way @Vankurt you have posted this in 2017 , in 2019 , i am facing the same issue. probably some developer from the open community needs to work in it.

For those who encounter blank page after testing their flatdoc page for a while, you may be subject to github API's request rate limit. Your error message in the console may include something like

GET https://api.github.com/repos/USER/REPO/readme 403 (Forbidden)
flatdoc.js:461 [Flatdoc] fetching Markdown data failed.

(where USER is your github user name and REPO is your repository)
Tracing the GET link yields further details:

{
  "message": "API rate limit exceeded for 43.153.32.765. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
  "documentation_url": "https://developer.github.com/v3/#rate-limiting"
}

The problem is because github limits unauthorized requests to 60 times per hour. I haven't found a solution yet but it seems that changing to authorized requests may solve the problem because you can make up to 5000 authorized requests per hour.
One potential solution when your do not need to change your README is to cache it.

Also suddenly having this issue with a website. Not sure what's going on. Curious if @rstacruz has some ideas on a fix.