Explicit anchors/labels for numberable items

Hi
I’m a researcher who wants also to publish his papers as ebooks, true e-pub format, allowing reflowing of pages dependent upon screen size of the e-paper device, the user selected font, font size, margin … .

CommonMark is one of the two most promising source formats. Amongst others i do miss a way to add explicit tags/labels/anchors to numerable items, such as Headers, Images (captions), tables (captions), code blocks (captions), Numbered items, etc.

Maybe this is already possible without resorting to HTML but i do not get how. The only discussion i have found which is related to this is the discussion about auto generated anchors for headings. For my needs this is on one hand too limited to headers only and second I do not need for every header an anchor just for selected ones and i would need them also for Images or image captions which should flow along with the image or table and sometimes it is necessary to reference from text list items, eg when describing a work flow, or even put text on top of an image to label elements within an image which than can be referenced from the preceding and following text.

All in all i would prefer if I explicitly could control the anchor for those numerable Items i want to explicitly reference inside the text without the need to put the full url.

Would that be possible by existing reference links by just using the html anchor part inside the link but how to use this to define the header, image, table, etch to be the anchor destination

Greeting
Xristoph

I’ve been working on a couple markdown post-processors to handle tasks that aren’t covered by markdown but can still be handled automatically.

One of the post-processors that I’ve started on handles ID generation for headers. This could easily be expanded to work for various other element types. So far I have the beginnings of a PHP version (ID8PHP). I have plans to make a JS lib for this as well.

Automatic id’s (i calle them labels below) is not practicable in scientific texts

  1. labels are not unique to headers
  2. items which have labels attached are numbered for better readability of the text, and better orientation within the structure of the text (requires enumerable headers, at least supported by backends)
  3. labels have not only be unique but also recognizable and memorable as such by who ever reads and edits the sources (which is not always intrinsic to header texts or even figure and table captions and equations do usually have not text which could be used as unique anchor ID)
  4. labels should provide some hint whether they reference a header, a numbered figure/image, a numbered table, a numbered formula or any other numbered item (eg: hdr:header_second_sub_of_first_chap, fig:figure_showing_my_first_car_as_a_student)
  5. the postprocessor should be capable to replace these labels by at least the number of the referenced item or on request also prepend or postpend the label of the item

section 1.2
figure 3
equation 6 or equation 3-6

  1. Numbers change when an item of same type is added before the one linked to the label, or when headers or list items are renumbered due to insertion of new header
1 Like

Consider the proposal at
http://talk.commonmark.org/t/turning-empty-link-definitions-into-anchors/893

I don’t think the considerations against that proposal are very strong, so I’m strongly inclined to implement it.

Would this work for your purposes?

“X can’t be done” is often said when people actually mean to say “I don’t know how to do X”.

Automatic IDs seem problematic regardless. What would you generate an ID from to begin with? The ID would be required to remain the same even if you edit or move the referenced target. There may also be several equivalent equations (e.g. repeating a prior equation for reference) or equally named sections, yet the reference would have to specify a unique, unchanging target.

The only systems I am aware of, that offer automatic IDs, are word processors like MS Word and those can only do so, because the ID is hidden from the user, i.e. the automatism is a feature of the editor, not the file format.