Asciidoc - Files with CRLF line endings on targets when using the include
directive do not show in the markup
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
Files with CRLF line endings on targets when using the include
directive do not show in the markup.
Steps to reproduce
- Create a new repo
- Create a README.adoc file with the contents:
== Version Information 1 Version: include::version1.adoc[tag=version] == Version Information 2 Version: include::version2.adoc[tag=version]
- Create a
version1.adoc
with the contents:// tag::version[] v1.0.0 // end::version[]
- Create a
version2.adoc
with the contents:// tag::version[] v2.0.0 // end::version[]
- However, ensure you save this file with CRLF (DOS) line endings. How you do this will depend on your editor. In Vim, you can save the file with CRLF line endings with the command
:set ff=dos
.
- However, ensure you save this file with CRLF (DOS) line endings. How you do this will depend on your editor. In Vim, you can save the file with CRLF line endings with the command
- Check that
version1.adoc
andversion2.adoc
have respective line endings for this test:$ file version1.adoc version2.adoc version1.adoc: ASCII text version2.adoc: ASCII text, with CRLF line terminators
- Push the repository to GitLab.
- Observe the markup README will only
include
the text fromversion1.adoc
. (See screenshot below)
What is the current bug behavior?
Text with CRLF endings do not get shown in the asciidoc markup.
What is the expected correct behavior?
Text with CRLF endings do get shown in the asciidoc markup.
Relevant logs and/or screenshots
Workaround.
- Convert files to LF endings.
- Configure Git on any Windows machines to use Unix based line endings, to prevent this from happening again. See the official git documentation here.
Possible fixes
Edited by 🤖 GitLab Bot 🤖