fedwiki / wiki-server

Federated Wiki client and server in Node.js
Other
153 stars 35 forks source link

HTML markup on initial page load #93

Closed paul90 closed 9 years ago

paul90 commented 9 years ago

The server rendered page displays content which has been escaped. For example:

  <body>
    <section class='main'>
      <div class='page' id=welcome-visitors  data-server-generated=true>&lt;div class="twins"&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;
&lt;div class="header"&gt;&lt;h1&gt;&lt;a href="/" style="text-decoration: none"&gt;&lt;img  height="32px" src="/favicon.png"&gt;&lt;/a&gt; Welcome Visitors&lt;/h1&gt;&lt;/div&gt;
&lt;div class="story"&gt;&lt;div class="item paragraph"&gt;&lt;p&gt;Welcome to the <a class="internal" href="/federated-wiki.html" data-page-name="federated-wiki" title="">Federated Wiki</a>.&lt;/p&gt;&lt;/div&gt;
&lt;div class="item error"&gt;&lt;p&gt;markdown&lt;/p&gt;&lt;/div&gt;
&lt;div class="item paragraph"&gt;&lt;p&gt;<a class="internal" href="/paul-rodwell.html" data-page-name="paul-rodwell" title="">Paul Rodwell</a>&lt;/p&gt;&lt;/div&gt;
&lt;div class="item error"&gt;&lt;p&gt;markdown&lt;/p&gt;&lt;/div&gt;
paul90 commented 9 years ago

Problem looks to be caused by calling wiki.resolveLinks (from the client) on the rendered page. A fairly recent change to resolveLinks added content sanitization, with escaping being the default.

A better solution will be to call resolveLinks on each page item, rather than the page as a whole.