Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setting to create new files with markdown file extension (.md) #24

Closed
eppfel opened this issue Dec 2, 2016 · 93 comments · Fixed by #223
Closed

Add setting to create new files with markdown file extension (.md) #24

eppfel opened this issue Dec 2, 2016 · 93 comments · Fixed by #223
Labels
enhancement New feature or request
Milestone

Comments

@eppfel
Copy link
Member

eppfel commented Dec 2, 2016

I don't know, if this was discussed before, but new files are created with the .txt extension. If you want to edit the files directly in the Notes folder with another editor (e.g. icewind1991/files_markdown or on Desktop), the file format is not recognized.

@eppfel eppfel added enhancement New feature or request question labels Dec 2, 2016
@Henni
Copy link
Member

Henni commented Dec 10, 2016

Should we introduce a setting for this? I think defaulting it to .md might irritate some users which are unable to open it on their system because they have never seen this extension. But I could be overthinking this.
@jancborchardt your opinion on this?

@korelstar
Copy link
Member

I vote definitely for a setting for this. .md is too nerdy to be the default. 😎

@eppfel eppfel changed the title Create new files with markdown file extension (.md, .mdown, .markdown) Add setting to create new files with markdown file extension (.md) Dec 10, 2016
@eppfel eppfel removed the question label Dec 10, 2016
@phsc84
Copy link

phsc84 commented Dec 10, 2016

Another idea:
Instead of adding a setting, I would suggest to do it similar to the Files app, which adds .txt by default to the end of a new file.

  1. Add .md by default to the end of a new note. If someone overwrites .md with .txt for whatever reason, accept it. Save the note with the according file extension. If someone adds another file extension, display an error like "File extension unsupported. Please use '.md' or '.txt'!".
  2. Add an info box, explaining .md (for all the non-nerds): "The Notes app uses Markdown to save notes. The default file extension for Markdown is '.md'. If you prefer, you can also use '.txt' alternatively."

@jancborchardt
Copy link
Member

Sooo first off, @icewind1991’s Markdown editor should simply also recognize txt files. ;)

About the rest I need to think more, but .md should not be a default for sure. It’s only used and known by a tiny percentage of people.

@eppfel
Copy link
Member Author

eppfel commented Dec 15, 2016

So, I really would like to have the setting. Otherwise I will have to write a service that checks the Notes folder and replaces the extension.

And I am curios: Would users that don't know about .md really manually edit their notes with a text editor or would they have another notes app for mobile/desktop?

@jancborchardt
Copy link
Member

The problem with a setting is (as I also told @Henni) that it can’t be a global setting really. Because sometimes you might write markdown, sometimes just text.

Isn’t there a way we can detect as soon as markdown is used and rename? I mean, the title can also change at any point. And Markdown can be detected by ## (single hash could be used for other things) or [link](url) or **bolding** or more.

@korelstar
Copy link
Member

Auto detection will not work always correctly, so there would be still the need for a manual setting.

I still think that a global setting would be fine (it would be definitely better than auto detection without manual correction per note), since people who are familiar with markdown and activate .md globally are still able to fill the files with text only.

Btw., do you would deactivate markdown parsing/preview if the file type is not .md?

@jancborchardt
Copy link
Member

jancborchardt commented Dec 17, 2016

I guess I’m fine with a setting if you really really think there’s no automatic way to handle this @nextcloud/notes. Of course the default should be .txt (like now)

Btw., do you would deactivate markdown parsing/preview if the file type is not .md?

@korelstar when you use Markdown syntax then it should be properly rendered regardless of the file extension. That’s the whole point of the seamlessness of it. ;) Especially if we introduce that setting with txt by default.

@claell
Copy link

claell commented Jan 22, 2017

@jancborchardt Why do you think this cannot be a global setting? If someone just writes text in a Markdown document this would work as well, or am I wrong?

@jancborchardt
Copy link
Member

@claell yes, it works when writing text in a Markdown document, but not the other way around. If you for some reason decide to set the default to txt then typing markdown would not render it. And that behavior makes little sense, especially as txt is the better default.

@claell
Copy link

claell commented Jan 24, 2017

@jancborchardt As far as I understand answers to this, .txt is default to not irritate inexperienced users. And in this app rendering also works when writing Markdown in a txt, this is how it is currently done.

If there are experienced users who understand what markdown is, they can set the extension to .md, This only changes the extension, not the behaviour of the app.

@jancborchardt
Copy link
Member

@claell ok, but this requires that all third-party apps interacting with the Nextcloud Notes app (like the Android one by @stefan-niedermann and the iOS one by @phedlund) can also handle .md files. :)

@Henni
Copy link
Member

Henni commented Jan 24, 2017

@jancborchardt the apps never see the extension.
They use the notes api which returns the file content inside the content attribute.
(see https://github.com/nextcloud/notes/wiki/Notes-0.2)

@jancborchardt
Copy link
Member

Ok, in that case nevermind. :)

@mejo-
Copy link
Member

mejo- commented Feb 6, 2017

To be honest I don't see why the default should stay .txt. Inexperienced users will never see the filename extension (be it .txt or .md), right?

The extension is merely interesting for experienced users who fiddle around with the files directly. And in that case, .md is much better. That way, text editors recognize the content as markdown and enable syntax highlighting.

@korelstar
Copy link
Member

Hmm. I think I would be fine with any solution. Let the maintainer decide ...

@benyanke
Copy link

I too would love the .md extension, both for my OCD and ease of use ;)

@eburghar
Copy link

eburghar commented Apr 4, 2017

.md is far better than .txt. At least if you install the nextcloud markdown editor app, you have a nice online editor with side preview and syntax highlighting.

@eppfel
Copy link
Member Author

eppfel commented Apr 9, 2017

I think the supporters of this issue made their point. I can fully support @mejo-'s comment here.

Can someone from @nextcloud/notes respond to that, so we can either start on developing a setting or just change the extension...

@patrikx3
Copy link

please for .md , use .md extension
it is not txt

@korelstar
Copy link
Member

@Henni @LukasReschke @jancborchardt
We need a maintainer decision, here:

  1. Use .txt or .md as default suffix for new notes (current is .txt, but files with .md are also recognized and processed in the same way (full list of supported extensions: txt, org, markdown, md, note))?
  2. Provide a setting or not for the default suffix for new notes?

Please commit to a common opinion, "the community" wants to implement something!

@putt1ck
Copy link

putt1ck commented May 6, 2017

I vote for:

use txt as default, recognising other text files - but does that need to be by suffix? My computer will try to open files as text, e.g. with less, and warns before proceeding if it recognises them as binary files; maybe there is a simple test to use to check if a file is text or not.

Let people choose (free text entry) a default suffix.

@patrikx3
Copy link

patrikx3 commented May 6, 2017

if it is md, use md extension. you will soon have md editor

@KopfKrieg
Copy link

Nothing against your post, but:

unnecessary settings will mess up the GUI.

You expect a simple switch between "Plaintext (.txt)" and "Markdown (.md)" will "mess up the GUI"?


Okay, back to the topic:

I don't think there is any case one wants to use .txt, that is why I proposed auto-migration.

Maybe some custom setups. As I already wrote, the current implementation will preserve the file ending. Why not just let it be that way? I'm all for giving users the choice and not breaking the current behaviour. Auto-migration would break the current behaviour and might confuse people.

Is there an OS that cannot open .md files by default/doesn't come with an .md editor so that .txt is needed? If not then this is not necessary.

Technically, *.md and *.txt files are both just plaintext. There shouldn't be any issue on any operating system to open both file types. But: *.txt files often gets opened with the default editor, while *.md files sometimes require the user to choose an application. That's a little bit unconvenient, but I'm sure most people are able to select "Open with $default_editor".

@mejo-
Copy link
Member

mejo- commented Apr 23, 2018

to stay with semver x.y.z (https://semver.org/)

  • create a new minor version y where a setting default_extension exists to configure the extension for new files. first default for this setting is set to txt, so it is still the default extension.
  • add the info the readme that the behavior of creating txt extensions is deprecated and that in the next major version md would be the default one. add a link to info about markdown and how to get a markdown editor on each platform (ideally a opensource one),
  • don't hurry for the next major release so that the users and admins have time to prepare for the change
  • on the release of a new major version x change the setting default_extension to md to create new files as markdown

That's a well defined upgrade path. Why not do it exactly as @c33s suggested?

@claell
Copy link

claell commented Apr 23, 2018

You expect a simple switch between "Plaintext (.txt)" and "Markdown (.md)" will "mess up the GUI"?

I consider everything not needed in GUI as mess, so yes that is what I think, although the impact is very low. But consider a new user installing the notes app and checking the settings to make sure everything is as he wants it to be. Now he has an additional setting to consider that might not be needed to consider. Of course it is not much impact, but a bit, especially, if it is not needed by anyone.

Maybe some custom setups.

Ok, so nothing concrete, just a feeling you have? Still might be true that something is broken by that.

As I already wrote, the current implementation will preserve the file ending. Why not just let it be that way? I'm all for giving users the choice and not breaking the current behaviour. Auto-migration would break the current behaviour and might confuse people.

Well, having both, .md and old .txt files sounds even more confusing to me. Adding some message however might help with both types of possible confusion. Also please remember that also the change to .md as default will break the current behaviour.

Edit: Just saw that I replied to @c33s there. So if any OS can open .md files there is no need to "add a link to info about markdown and how to get a markdown editor on each platform (ideally a opensource one)"

Technically, *.md and *.txt files are both just plaintext. There shouldn't be any issue on any operating system to open both file types. But: *.txt files often gets opened with the default editor, while *.md files sometimes require the user to choose an application. That's a little bit unconvenient, but I'm sure most people are able to select "Open with $default_editor".

Ok, so if there is not a problem with some OS, then I don't really understand why having an option to change the extension to .txt will make things more convenient than selecting open with default editor. (However there is a case where it is a bit easier when having multiple devices where one has to select the editor). But to me that cannot count as an argument.

That's a well defined upgrade path. Why not do it exactly as @c33s suggested?

Well I already mentioned one flaw in the steps (last part of step 2 is not really needed). Also step 4 needs some discussion (having both old .txt and new .md files parallel or migrating everything to .md).
Most important thing: This change is really not a big deal, while this "path" seems to be suitable for bigger upgrades. This does not mean it cannot be applied here, but also consider there is only a limited amount of time, so one should not waste it with unneeded effort.

@c33s
Copy link

c33s commented Apr 24, 2018

Not for everything. If it's a global setting I'm totally fine with changing values in a config file. But if we want per user settings a gui would be absolutely necessary.

currently there is only a hardcoded value, no per user option no global option. the config value is a quick win.

some stupid php constant which everybody can change as long as the constant is defined in a specific config file. my input for a quick win is a config value. not a over 1 year discussion with no result, my suggestion can be implemented in no time as config value (no gui to design, no functional testing) only add config value, document it and add a unit test for it. done.

in another iteration, when the devs have time, or somebody want to create a bigger PR for the feature of setting the config per user, this small change of a global constant can easily be refactored (10min to remove the global constant, the small section in the docs, remove of the unit test. done.)

Ok, so nothing concrete, just a feeling you have? Still might be true that something is broken by that.

this are not feelings, when you use a software and is ships .txt all the time, suddenly it ships .md something will break at someones workflow (if the installation is big enough many many users are confronted). if a script looks for new .txt files in a folder on the server for example. is you don't use such a script it is easy to say we don't need a proper upgrade path but if you depend on this to work you are happy to keep things working.

for example, google changed the handling of .dev domains. they bought the domains. many dev teams use .dev als internal domain. so this little change of google adding a hardcoded redirect from http to https for all .dev domains looks small but breaks a whole dev environment. result people stay on old chrome versions simply because they have no time to restucture the complete network/dns.

now you can say, well txt -> md is no big deal, its quickly fixed or changed in the script but things sum up. many of this small tasks can eat up your worktime. you want to use a product/software to help you build up your product or software. you want to invest the time in new features of your app, not in repairing things which work one patch version before. you want to have lts support so you can choose software and rely on it.

So if any OS can open .md files there is no need to...

as this discussion is half about beeing not able to open md file on all systems...

As said before, this will need a GUI.

everybody means every admin. so no gui.

Well I already mentioned one flaw in the steps

this steps can be adapted. it is a suggestion. it is really not complicated.

the config has also the option to allow the admin decide if it should be .markdown or .md or any other custom extension.


in general i don't really care if there is an option for configuring the extension, as soon as notes uses md as default ext i have what i want but i care for good and relyable software. so i think such a config is required. for all the poor admins out there, who require txt because they cannot teach all there users how to use a markdown editor, or cannot install a markdown editor for all users, or

@claell
Copy link

claell commented Apr 29, 2018

some stupid php constant which everybody can change as long as the constant is defined in a specific config file. my input for a quick win is a config value. not a over 1 year discussion with no result, my suggestion can be implemented in no time as config value (no gui to design, no functional testing) only add config value, document it and add a unit test for it. done.
in another iteration, when the devs have time, or somebody want to create a bigger PR for the feature of setting the config per user, this small change of a global constant can easily be refactored (10min to remove the global constant, the small section in the docs, remove of the unit test. done.)

I guess nobody will stop you from creating such PR, but I don't know whether you are willing to do one. I also support having some quick fix. The question is, who will do it?

this are not feelings, when you use a software and is ships .txt all the time, suddenly it ships .md something will break at someones workflow (if the installation is big enough many many users are confronted). if a script looks for new .txt files in a folder on the server for example. is you don't use such a script it is easy to say we don't need a proper upgrade path but if you depend on this to work you are happy to keep things working.
[...]
now you can say, well txt -> md is no big deal, its quickly fixed or changed in the script but things sum up. many of this small tasks can eat up your worktime. you want to use a product/software to help you build up your product or software. you want to invest the time in new features of your app, not in repairing things which work one patch version before. you want to have lts support so you can choose software and rely on it.

Ok, first: The notes are currently stored in a folder called "Notes". So there is probably no such script, but I get your point. You don't want to break things for users relying on the software. I understand it, and if someone has the time to do it then I agree with going the slow way. But I rather think there will be some trade-off.

as this discussion is half about beeing not able to open md file on all systems...

Yes and until now there has not been an example of a system which cannot handle them, only some wild statements without any proof/example (although Android or iOS might be problematic).

everybody means every admin. so no gui.

This might also break behaviour for some users who have set up scripts without the admin knowing about it. So it is not only about the admin. And don't forget about self-hosted installations. These "admins" will probably not want to change some config values somewhere just to get their wanted behaviour, nor will many of them keep track of release notes thought for admins.

But just to let you know: Afaik currently the Notes app does not offer GUI settings at all. So introducing one (I still question whether it is needed) will need additional thinking.

this steps can be adapted. it is a suggestion. it is really not complicated.

They only take some time. If someone (the devs for example) has the time to do it, I say do it. But I don't know their current behaviour/workflow with changes like this, so I want to leave it to them/the one implementing it.

in general i don't really care if there is an option for configuring the extension, as soon as notes uses md as default ext i have what i want but i care for good and relyable software. so i think such a config is required. for all the poor admins out there, who require txt because they cannot teach all there users how to use a markdown editor, or cannot install a markdown editor for all users, or

As said before: They don't have to teach their users how to use a Markdown editor, because no Markdown editor will be needed to edit .md files. This also means they won't need to install such an editor for all users and I also wrote that before. I really would like to do this discussion fact based, I don't know why you come up with that same argument again.

@korelstar
Copy link
Member

I've implemented the requested setting in #223. Please test and give feedback!

@korelstar korelstar modified the milestones: M2 – 🚀 New nice features, 2.4.0 Aug 2, 2018
@korelstar korelstar removed help wanted Complex issue or we don't know how to fix it markdown labels May 24, 2019
korelstar pushed a commit that referenced this issue Apr 24, 2020
#37 Headlines rendered as normal text
#24 Line breaks ignored

bypass now renders the markdown on every call. caching is disabled now.
korelstar pushed a commit that referenced this issue Apr 24, 2020
@glow12121
Copy link

I've implemented the requested setting in #223. Please test and give feedback!

Hi, Korelstar. I've just installed the Notes app on my Android phone and do not see the setting to create new files as .md. Could you give me a hint on where to search?

@stefan-niedermann
Copy link
Member

stefan-niedermann commented May 20, 2021

@thumos333 this repository is only about the server app. The repository for the Android app is here: https://github.com/stefan-niedermann/nextcloud-notes/issues

Currently the settings can only be changed in the Web UI (at the bottom left), but the next release of th Notes server app will ship an extended API which will allow client apps to change the settings.
For the Android app the work is pretty much done and will be shipped in a future version as soon as it has been tested with the new API, so just be a little bit more patient 🙂

@glow12121
Copy link

For the Android app the work is pretty much done and will be shipped in a future version

That's awesome. Many thanks for the reply. This would be a much needed function. I am glad I've started using NC Notes now when it is about to arrive.

@stefan-niedermann
Copy link
Member

Glad to hear that! I am curious why changing this setting is a much needed function in the Android app for you? How often and why do you switch between .txt and .md?

Keep in mind that you already can change this setting today in the Web UI (which also will be applied to new notes which you create via the Android app).

@glow12121
Copy link

Glad to hear that! I am curious why changing this setting is a much needed function in the Android app for you?

I work with dozens of notes and make many edits to them every day. Some are 300 kb long, or so. I was very glad to discover that NC Notes can edit notes as .txt or .md and save them in folders. (Combined with auto-syncing, a clean design and some other simple but important functions, this is actually a very rare combination among Android note-taking apps.)

I never edit on the web but only on my PC and Android. On the PC, I use the Markdown format and Sublime Text as the editor, hence all files are saved as .md. It's not a huge problem to have some files (those created on Android) as .txt and manually rename their resolution - but still an inconvenience. If the text is a .txt, Sublime may sometimes recognize it as plain text; perhaps there may be some rendering inconveniences when converting into office documents.

@stefan-niedermann
Copy link
Member

It's not a huge problem to have some files (those created on Android) as .txt and manually rename their resolution - but still an inconvenience

Again: If you toggle the setting the Web UI of the Notes app (this is already possible since a long time in the bottom left section of the Notes browser app), all further Notes, including the ones you create with the Android app will be stored as .md in the future. No need to wait for this setting in the Android app. Just set .md in the settings section of the Notes app in your browser and it will automatically also affect the Android app.

@glow12121
Copy link

all further Notes, including the ones you create with the Android app will be stored as .md in the future

Ach so! Many thanks for letting me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.