As noted earlier, the general content rendering is broken. Here `content` should actually be `@model.content` as the latter gives you the raw content data extracted from the file.

However, in realizing this, the better implementation is render the the page's content as it would be rendered in any other scenario e.g. with `ruhoh.master_view(@model.pointer).render_content`. This provides the correct global context to the particular page being rendered.

Here's the fully changed code that you can update your pull request with and it should work very nicely with all of your nokogiri additions:

```ruby
full_content = ruhoh.master_view(@model.pointer).render_content
content_doc = Nokogiri::HTML.fragment(full_content)
```