Skip to content

Editing .md files in dark mode #10593

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

Closed
timint opened this issue Sep 24, 2021 · 11 comments
Closed

Editing .md files in dark mode #10593

timint opened this issue Sep 24, 2021 · 11 comments

Comments

@timint
Copy link
Contributor

timint commented Sep 24, 2021

Editing .md files in dark mode is a challenge. Maybe someone has a fix for that?
I thought I would bring this up as it's been this way for many versions now.

image

@timint
Copy link
Contributor Author

timint commented Sep 24, 2021

And so I discovered a separate Language setting for dark mode markdown which feels half baked. Is it not possible to have it honouor the selected style theme instead?

image

@ts-50
Copy link
Contributor

ts-50 commented Sep 25, 2021

Those Markdown settings are actually "User Defined Languages" created with Edditoria: https://github.com/Edditoria/markdown-plus-plus.

You'll need to go to that link and follow the instructions.

Download the source code in latest release page. It should be a zip file.
Open the zip file and go to  folder.
Copy a XML file of your favorite theme, and paste in  folder of Notepad++.
    (The directory is usually <%AppData%\Notepad++\userDefineLangs\>.)
Restart Notepad++.
Open and test with a Markdown file e.g. test/at-a-glance.md.

Copy the XML file of whatever theme you're using (looks look Obsidian?) into the userDefineLangs folder, close and reopen N++, and it should be there. That link also tells you how to create custom MD files for your own custom themes.

Upon extracting the .tar.gz (or .zip):
image
Double-click that:
image
Go to udl:
image
and copy markdown.obsidian.udl.xml.

In your C Drive go to Users >> [your username] >> Application Data >> Notepad++ >>> userDefineLangs and copy that file.

@timint
Copy link
Contributor Author

timint commented Sep 25, 2021

I want to thank you for the time and effort spent in replying to me. I see the markdown support is a complete side project.

Indeed it is Obsidian. Well spotted. 😀

I copied markdown-plus-plus-master.zip\udl\markdown.obsidian.udl.xml to %appdata%\Notepad++\userDefineLangs\ and that solved the problem, thank you. Is this the intended solution by design? Or is this just a workaround due to framework limitations?

Spontaneously I would have thought the most optimal implementation would be to add it as a Language like any other languages built in. Yeah, markdown is not a language, but seeing YAML in the list makes me think why not? But then I am a web developer and cpp is just not my thing. Maybe @Edditoria have some good input on this?

@rdipardo
Copy link
Contributor

rdipardo commented Sep 26, 2021

I would have thought the most optimal implementation would be to add it as a Language like any other languages built in.

You're not alone; to quote from this related thread1:

[. . .] Scintilla has markdown support builtin for ages. And then suddenly markdown was implemented as a UDL instead of utilizing what was already within reach.

While N++ could just as well use Scintilla's Markdown lexer (the way Geany does), I would say you're better off using @Edditoria's implementation. The Scintilla version is kind of a neglected, bit-rotten, legacy module (and @donho already knows this: #7792). UDL's are just much quicker to develop and update than lexer libraries.

Footnotes

  1. See also: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11099#issuecomment-1024294168

@ts-50
Copy link
Contributor

ts-50 commented Sep 27, 2021

Not a problem. I think it would be best to include all the markdown themes in the software by default, then have one language option (under M): Markdown (or "MD") and then have the program automatically be able to recognize which theme the user is using and then apply the Markdown language file accordingly. But I don't have any idea how to do that.

@timint
Copy link
Contributor Author

timint commented Sep 27, 2021

I personally wouldn't mind if the syntax colors are a bit different. It's the highlight coloring of the text background that I find most critical. If it could only be transparent.

Is it not possible to just inherit some of the colors from the global style?

image

@CennoxX
Copy link
Contributor

CennoxX commented Sep 28, 2021

@timint This is possible with the colorStyle attribute

The colorStyle attribute decides whether to use the defined colors from fgColor and bgColor attributes, or to use the default color setting

https://github.com/notepad-plus-plus/npp-usermanual/blob/master/content/docs/user-defined-language-system.md

I think the WordStyles of markdown should use colorStyle="0" for DEFAULT and for most other colorStyle="1".

@ts-50

This comment has been minimized.

@CennoxX
Copy link
Contributor

CennoxX commented Oct 4, 2021

@thomassmith311 Did you read my comment? As I said, it is possible, just use the colorStyle attribute.
grafik

My changes were adding colorStyle in the Style section:

        
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
        

@ts-50
Copy link
Contributor

ts-50 commented Oct 4, 2021

@CennoxX Didn't see that comment. (just hid my comment as it's unhelpful.) Yeah, I just tried that xml on all the themes and it works perfectly for all of them. We should probably get this in a pull request. Can just go to PowerEditor / bin / userDefineLangs (https://github.com/notepad-plus-plus/notepad-plus-plus/tree/master/PowerEditor/bin/userDefineLangs) and edit the contents of that folder. (I'll leave that for you, since you found the solution. Or, if you don't mind me making the request, I'll make sure to credit you)

@ts-50
Copy link
Contributor

ts-50 commented Oct 5, 2021

I made a pull request with a single udl file that should work with all notepad++ themes - that way, we won't need multiple Markdown options; the user should just be able to select "Markdown" and it work with whatever theme they want, whether custom or one of the default.
#10621

@donho donho closed this as completed in b4d94f5 Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants