Normally, when I use orgmode's export function on a buffer that contains noweb references, they get expanded, resulting in lots of duplicated code throughout the exported HTML document.

Is there a way to export an orgmode buffer without expanding noweb references, so they still show up as <<reference>> in the exported document?

up vote 2 down vote accepted

To export a buffer without expanding noweb references, you can set the following at your src header, as per documentation:

#+begin_src language :noweb no-export

To define that globally, you can add the following at the top of your Org File:

#+property: header-args :noweb no-export

Or language specific:

#+property: header-args:languagename  :noweb no-export
  • It seems that adding this property to anything except the specific begin_src block fails when there is already a :noweb yes added to it. It also seems that only either :noweb no-export or :noweb yes can be set, not both... – Daniel Ziltener Nov 26 at 17:43
  • What I left out: I tried just adding #+property: header-args :noweb no-export, but that resulted in org-babel-tangle not expanding them either, despite the documentation saying otherwise. – Daniel Ziltener Nov 26 at 17:49
  • @DanielZiltener Yes, properties on the top of the file will be overwritten by properties at the block level. Blocks inherit parent properties, but can override them. In fact, the header args can be used for any argument, not only :noweb. – dangom Nov 26 at 18:11
  • If the documentation says something that does not correspond to the behaviour you experience, and if that functionality is important to you, I'd suggest creating a minimum example and opening an issue at the mailing list. – dangom Nov 26 at 18:14
  • Thing is, even when there's no :noweb property at block level, the global property has no effect. On block level, it works though. – Daniel Ziltener Nov 26 at 18:21

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.