add a newline at the end of each file (cross-platform compatibility)
- Dominant language
- Java
- Stars
- 6.1k
- Forks
- 537
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 4
Description
### ⚠️ This issue respects the following points: ⚠️
- [x] This is a **enhancement/feature request**. Not a [bug or question](https://github.com/gsantner/markor/issues/new/choose).
- [x] The topic is **not** already reported at [Issues](https://github.com/gsantner/markor/issues?q=#js-issues-search). _(I've searched it and checked most recent issues)_.
- [x] Markor **is** up to date. See [Releases](https://github.com/gsantner/markor/tags) for the latest version. Updates are available from [F-Droid](https://f-droid.org/en/packages/net.gsantner.markor/) and GitHub.
- [x] The wanted feature/enhancement is not present in the latest development version (git master). (Please [download](https://nightly.link/gsantner/markor/workflows/build-android-project/master) and try the test version of Markor, named **Marder**. Don't worry; Markor and Marder appear as completely separate applications. You can install both side-by-side, and Markor's settings are not touched. If your desired feature is present, you don't need to open this issue. The change will be part of the next Markor update.)
### Description
1. [Ending a text file in a newline character is a Unix convention](https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file) which native text editors follow.
2. Markor does not add the newline character when saving, which will for instance result in redirected output (`>>` in Bash) being written on an existing, non-empty line. I edit some of my files using both Markor and various Linux software (Termux on Android, desktop Linux); URLs in particular can be time-consuming to fix (e.g. `https://www.youtube.com/watch?v=jNQXAC9IVRw` may change to `https://www.youtube.com/watch?v=jNQXAC9IVRwab`).
3. Can you ensure that all files modified by Markor end in the newline character?
### Information
Android version: LineageOS 23 (Android 16)
Device (phone model): Oneplus 8T
App Version: v2.16.1
### Source
F-Droid
### Format / File type
Something else (-> Additional info)
### Additional info / Log
```shell
All but the binary file formats seem to be affected.
For now I simply edit all text files shared with Markor using vim on the desktop — I can't conveniently write to the Markor-modified files with say `tee` or `cat`, without scripting in some additional logic.
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating Markor’s save logic for text and binary file formats, then inspect how file content is written. Confirm which non-binary formats are affected and define completion as ensuring every file Markor modifies ends with a newline without changing binary handling; add or run relevant save tests if the project provides them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100