blackhole89 / notekit

A GTK3 hierarchical markdown notetaking application with tablet support.
GNU General Public License v3.0
1.44k stars 61 forks source link

markdown issue: table, heading and code #111

Open starsareintherose opened 2 years ago

starsareintherose commented 2 years ago

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 commented 2 years ago

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

sp1ritCS commented 2 years ago

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

sp1ritCS commented 2 years ago

tables are not supported rn (see #47)

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

starsareintherose commented 2 years ago

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

blackhole89 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

starsareintherose commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

starsareintherose commented 2 years ago

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.