Commit Graph
4 Commits
Author SHA1 Message Date
John MacFarlane 30442b7f9d Change to --file-scope behavior.
Previously a Div with an identifier derived from the filename
would be added around the contents of each file.  This caused
problems for "chunking" files into chapters, e.g. in EPUB.

We no longer add the surrounding Div. This cooperates better with
chunking. Note, however, that if you have relied on the old
behavior to link to the beginning of the contents of a file using
its filename as identifier, that will no longer work.

Closes #8741.
2024-04-20 16:28:42 -07:00
John MacFarlane ff22116426 Revert "Markdown reader: avoid duplicate ids with auto_identifiers."
This reverts commit eff82cfe4d.
2022-10-18 12:51:12 -07:00
John MacFarlane eff82cfe4d Markdown reader: avoid duplicate ids with auto_identifiers.
We previously avoided generating a duplicate with another automatically
generated identifier; now we also avoid duplicates with explicit
identifiers that occur before the header for which an identifier
is being generated.  (Collisions are still possible for identifiers
that occur after the header.)

T.P.Shared: `makeSections` is also modified so it doesn't give
bad results when the enclosing Div has a different identifier
from the header, as may now happen.
2022-10-18 12:42:12 -07:00
John MacFarlane 311a340687 Add prefixes to identifiers with --file-scope. (#8282)
This change only affects the case where `--file-scope` is used
and more than one file is specified on the command line.

In this case, identifiers will be prefixed with a string
derived from the file path, to disambiguate them. For example,
an identifier `foo` in `contents/file1.txt` will become
`contents__file1.txt__foo`.  Links will be adjusted accordingly:
if `file2.txt` links to `file1.txt#foo`, then the link will
be changed to point to `#file1.txt__foo`.  Similarly, a link
to `file1.txt` will point to `#file1.txt`.  A Div with an
identifier derived from the file path will be added around
each file's content, so that links to files will still work.

Closes #6384.

[API change]: Text.Pandoc.Shared exports `textToIdentifier`.
2022-09-18 18:11:40 -07:00