On Tue, Mar 20, 2018 at 3:53 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

The code was fixing links in the whole document, not only in the subtree
you were including.

The problem lay somewhere else in the file, in the "* Hey! I have a link
[[https://example.org][here]] (Awesome!)" headline.

That was a pathological test case for ox-hugo :)
 
There, `org-element-context' needed to check the headline, by (looking-at
org-complex-heading-regexp). However, since the changes were happening in Fundamental mode, the regexp was not set. Hence the error.

Thanks! It makes sense now.
 
So, the fix implements the following changes:
- only modify links withing the included part of the document,
- do not modify anything if includer and includee both live in the same
  directory,
- switch to Org mode before proceeding with changes.
--

Kaushal Modi