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

markdown issue: table, heading and code #111

Open
starsareintherose opened this issue Dec 16, 2021 · 11 comments
Open

markdown issue: table, heading and code #111

starsareintherose opened this issue Dec 16, 2021 · 11 comments

Comments

@starsareintherose
Copy link

starsareintherose commented Dec 16, 2021

2021-12-16 03-59-49 的屏幕截图
2021-12-16 04-03-25 的屏幕截图

-- can not be recognized as headings https://www.markdownguide.org/basic-syntax/#alternate-syntax and the table can not be shown. sidebar is transparent.
my config information

                  -`                     guoyi@helix
                 .o+`                    -----------
                `ooo/                    OS: Arch Linux [x86_64]
               `+oooo:                   Host: Inspiron 7380
              `+oooooo:                  Kernel: 5.10.85-1-lts
              -+oooooo+:                 Uptime: 19 hours, 46 mins
            `/:-:++oooo+:                Packages: 1290 (pacman)
           `/++++/+++++++:               Shell: zsh 5.8
          `/++++++++++++++:              Resolution: 1920x1080 @ 60Hz
         `/+++ooooooooooooo/`            DE: GNOME 41.2
        ./ooosssso++osssssso+`           WM: Mutter (Wayland)
       .oossssso-````/ossssss+`          WM Theme: Graphite-dark
      -osssssso.      :ssssssso.         Theme: Graphite-blue [GTK2/3/4]
     :osssssss/        osssso+++.        Icons: Tela-dark [GTK2/3/4]
    /ossssssss/        +ssssooo/-        Font: Cantarell (11pt) [GTK2/3/4]
  `/ossssso+/:-        -:/+osssso+-      Cursor: Adwaita (24px)
 `+sso+:-`                 `.-/+oso:     Terminal: terminator
`++:.                           `-/+/    CPU: Intel Core i7-8565U (8) @ 4.6GHz
.`                                 `/    GPU: Intel UHD Graphics 620
                                         Memory: 3011MiB / 15721MiB (19%)
                                         Disk (/): 60GB / 452GB (13%)
                                         Battery: 97%
                                         Locale: en_GB.UTF-8
@starsareintherose
Copy link
Author

can I adjust css under data/ to redefine the sidebar color?

@sp1ritCS
Copy link
Contributor

try building commit 18b708d. The way the sidebar color is handled got changed recently and it doesn't work that well for a lot of themes.

@sp1ritCS
Copy link
Contributor

tables are not supported rn (see #47)

and I think checking for -- as alternative to # for titles is quite hard using gsv.

@starsareintherose
Copy link
Author

starsareintherose commented Dec 16, 2021

Thanks, it works. and I found the space to make some thing code does not work, such as this

#include <stdio.h>
enum colors {red,yellow,green}; 
void f (enum color c);
int main (void)
{
	enum color t =read;
	scanf("%d",&t);
	f(t);
	return 0;	
}
void f(enum color c)
{
	printf("%d\n",c);
}

the original text is here, no ```, just space


    #include <stdio.h>
    enum colors {red,yellow,green}; 
    void f (enum color c);
    int main (void)
    {
    	enum color t =read;
    	scanf("%d",&t);
    	f(t);
    	return 0;	
    }
    void f(enum color c)
    {
    	printf("%d\n",c);
    }

could I use pandoc or any other tools to standardize the format as pre-process

@starsareintherose starsareintherose changed the title table and heading issue markdown issue: table, heading and code Dec 16, 2021
@blackhole89
Copy link
Owner

  • As sp1ritCS said above, we unfortunately can't support the syntax where titles are underlined with ---/=== easily due to parser limitations. Since it's redundant and less flexible than leading #s, I think this should not be too much of a problem...?
  • Table support would be nice, but is a pretty hard problem (almost "HTML-complete")
  • Four-space-indented code spans are another Markdown feature that is pretty hard to parse due to its non-local properties. (If a line is indented by four spaces, is it part of a source code span or is it because it's a continuation of some other indented environment, such as a bulleted list?) Unlike the underline headings, I believe that this would in fact be possible to support with limitations (by parsing all other indentation-based block syntax correctly, and then taking indented stretches to be code when they have not been recognised as anything else), but the implementation would be a bit nasty, and I wasn't sure if it's worth it since four-indent code spans seem to be pretty limited (can't specify the language to highlight in, etc.).
  • If you use source code listings a lot, I recommend ticking "enable syntax highlighting" in the Preferences page. This results in somewhat higher startup times, but lets you highlight any language supported by gedit in three-backtick code spans like cpp\n...\n.
  • By the way, did you build the program from source or download some (older?) prebuilt package? I notice that your Chinese text still renders as "sans-serif"/"gothic"/黑体-style font, but in a recent patch I changed the default css to choose a "serif"/宋体 one to match the Latin text. (data/stylesheet.css should say font: 16px Charter, Bitstream Charter, Noto Serif, Noto Serif CJK JP, Noto Naskh Arabic, serif;. Of course, you are free to tweak this.) If you are on an older build, I recommend updating.

You can tweak the schema which is used to parse Markdown by editing the spec which in most packages defaults to being loaded in /usr/share/notekit/sourceview/markdown.lang (or making a copy of that subtree in /usr/local/share/notekit), or could be in the sourceview/ subfolder for a portable installation such as the tar.gz build. It follows the GtkSourceView language spec format, though some special conventions (mostly context classes and special chars) that notekit uses to interface with Gsv need to be respected. If you can come up with a good way of improving some of the parsing limitations, I would be more than happy to accept a pull request.

@blackhole89
Copy link
Owner

blackhole89 commented Dec 16, 2021

Oh yeah, by the way, could you point me at a download location for theme that you are using? If you are/were using the most recent version, I am not sure I understand the rendering issues that you are having with the sidebar. You should of course feel free to adjust the css to make it render correctly, but I'm slightly taken aback that the default (which currently essentially just adjusts border-color to make the tree render correctly and otherwise tells it to copy the style from nemo (the cinnamon file manager)) worked so badly.

@starsareintherose
Copy link
Author

try this https://github.com/vinceliuice/Graphite-gtk-theme
a wonderful theme, @blackhole89

@starsareintherose
Copy link
Author

starsareintherose commented Dec 16, 2021

Oh, I build from the source based on @sp1ritCS 's opinion from a specific commit, if I can get a good command of C and gtk, I will consider PR, it is quite nice project, but better to follow some standard to publish tag

@blackhole89
Copy link
Owner

blackhole89 commented Dec 16, 2021

I think there is an issue in how the Graphite theme interacts with alpha-channel windows with a transparent background (such as notekit). I'm not sure if the problem is on our side or the theme's. You can fix the problem by adding a line like

.notekit .sidebar { background-color: rgba(12,34,56,1); }

to stylesheet.css (and potentially replacing the current line about border-color, which also seems to not work with Graphite), while replacing 12,34,56 with the appropriate background colour, or alternatively commenting out the line that says override_background_color(Gdk::RGBA("rgba(0,0,0,0)")); in mainwindow.cpp and rebuilding.

(edit: Either of these should also remove the need of building from an older commit.)

if I can get a good command of C and gtk

Well, the point of the Gsv language specs is that you don't actually need to know either or touch the source code at all to edit them.

@sp1ritCS
Copy link
Contributor

@starsareintherose I have some questions regarding your notekit-git package on AUR. Could you answer my comment I left on it, there?

@starsareintherose
Copy link
Author

I think there is an issue in how the Graphite theme interacts with alpha-channel windows with a transparent background (such as notekit). I'm not sure if the problem is on our side or the theme's. You can fix the problem by adding a line like

.notekit .sidebar { background-color: rgba(12,34,56,1); }

to stylesheet.css (and potentially replacing the current line about border-color, which also seems to not work with Graphite), while replacing 12,34,56 with the appropriate background colour, or alternatively commenting out the line that says override_background_color(Gdk::RGBA("rgba(0,0,0,0)")); in mainwindow.cpp and rebuilding.

(edit: Either of these should also remove the need of building from an older commit.)

if I can get a good command of C and gtk

Well, the point of the Gsv language specs is that you don't actually need to know either or touch the source code at all to edit them.

Thanks, it is solved. and if I have time to learn about this, I will contribute to it.

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

No branches or pull requests

3 participants