larstvei / ox-gfm

Github Flavored Markdown Back-End for Org Export Engine
230 stars 44 forks source link

CUSTOM_ID Property Referenced in the org-gfm-format-toc Function Must Be Upcased #19

Closed julienchastang closed 7 years ago

julienchastang commented 7 years ago

When building TOCs that reference CUSTOM_ID properties, I noticed that org-gfm-format-toc does not work correctly in building a TOC unless the CUSTOM_ID property referenced in the org-gfm-format-toc function is upcased. Otherwise the TOC entry will not reference the CUSTOM_ID anchor correctly inserting an auto-generated "fantom" anchor reference. Property keys in org-mode are supposed to be case agnostic. I'm not sure if this is the root problem, or a symptom of something more fundemental.

Emacs : GNU Emacs 25.1.2 (x86_64-apple-darwin14.5.0, X toolkit, Xaw3d scroll bars) of 2016-10-05

Package: Org mode version 9.0.5

larstvei commented 7 years ago

Thank you very much!

I want to merge the pull request ASAP, but I want to test it first. Could you provide a test case which demonstrates the problem and the fix?

julienchastang commented 7 years ago
#+OPTIONS: toc:t

* Headline 1
  :PROPERTIES:
  :CUSTOM_ID: h:2AA5EBD7
  :END:
* Headline 2
  :PROPERTIES:
  :CUSTOM_ID: h:B5A109A1
  :END:
* Headline 3
  :PROPERTIES:
  :CUSTOM_ID: h:C7425E49
  :END:

Before the change org-gfm-export-as-markdown would yield:

- [Headline 1](#orga617af5)
- [Headline 2](#orgb5a49dc)
- [Headline 3](#orgdff54eb)

<a id="h:2AA5EBD7"></a>

# Headline 1

<a id="h:B5A109A1"></a>

# Headline 2

<a id="h:C7425E49"></a>

# Headline 3

After the change in the PR, org-gfm-export-as-markdown yields:

- [Headline 1](#h:2AA5EBD7)
- [Headline 2](#h:B5A109A1)
- [Headline 3](#h:C7425E49)

<a id="h:2AA5EBD7"></a>

# Headline 1

<a id="h:B5A109A1"></a>

# Headline 2

<a id="h:C7425E49"></a>

# Headline 3
larstvei commented 7 years ago

Thank you very much for reporting and fixing this error!