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

Similar plugin #24

Closed
darkdragon-001 opened this issue May 1, 2020 · 8 comments
Closed

Similar plugin #24

darkdragon-001 opened this issue May 1, 2020 · 8 comments
Labels
question Further information is requested

Comments

@darkdragon-001
Copy link

I just released a fixed version of the gedit-markdown plugin: https://github.com/darkdragon-001/gedit-markdown

Would you like to combine our efforts?

@maoschanz
Copy link
Owner

maoschanz commented May 1, 2020

it looks like your readme hasn't changed that much since you began your fork, could you describe the current state of your plugin and its features?


Then concerning "combining our efforts", why not, but it looks like our projects are quite different, mainly because mine can use pandoc to convert from MD to HTML

What needs work in my plugin is:

  • keyboard shortcuts for inserting and removing markdown tags (WIP)
  • ability to customize the command line used to preview with pandoc
  • and, in this regard, provide a user-friendly UI to preview or export as a revealjs slideshow

And what works fine is:

  • preview in the panel the user wants
  • search in the preview
  • zoom in/out
  • render the document using python3-markdown with
    • a customizable list of plugins
    • CSS provided by the user
  • export the document using python3-markdown

@darkdragon-001
Copy link
Author

Some other people and myself tried to get the original maintainer to respond to pull requests and issues for several years - without success. I updated the README to the current state (only the pictures are a bit outdated). See my release announcement on what has changed in the last days.

Features

  • Render markdown (python3-markdown + plugins)
  • Preview (WebKit2.WebView)
  • Auto-refresh
  • Interaction with GtkSource's LanguageManger for type detection
    → Just search for "language" in my source code 😉
  • Convert to PDF via External Tools plugin (using pandoc)
    This was just a small hack but works

Missing features

  • Plugin preferences GUI → your plugin is doing very well here!
  • Keyboard shortcuts for markdown tags (as requested in Keyboard Shortcuts jpfleury/gedit-markdown#5)
    I think not many are needed here: bold, italic, underline, list
  • Preview interaction → your plugin is doing very well here!
    • Search
    • Zoom

I see my plugin as a lightweight preview and therefore would prefer not to have a hard dependency on pandoc. As additional converters in form of External Tools is fine for me. For more complex markdown projects, I use Atom with its plugins anyways.

@maoschanz
Copy link
Owner

it's not a hard dependency, most of the useless complexity of my code actually comes from managing cases where there is only python3-markdown but not pandoc, or the opposite

@darkdragon-001
Copy link
Author

What about wrapping the rendering part behind a common interface? Then you just have to call renderer.render(). And on creation you decide if renderer is a RendererPandoc or RendererPython based on availability?

In my code the rendering is a single call to python3-markdown. Of course pandoc has a lot more options which you want to reveal on the GUI, but something like renderer.registerYourCallbacks() and renderer.showYourOptions() should still work with the approach depicted above.

@maoschanz
Copy link
Owner

that would be worse imho: the rendering part is simple enough to be a single if, while the several GUIs have nothing in common, so doing a generic interface would be more complicated

anyway my code is uselessly spaghetti but it works quite well (except the 3 things i listed)

i'll probably add support for GtkSource's LanguageManager, i didn't do it at first for some reason i forgot, but i'm sure this reason isn't valid anymore

@darkdragon-001
Copy link
Author

i'll probably add support for GtkSource's LanguageManager, i didn't do it at first for some reason i forgot, but i'm sure this reason isn't valid anymore

One downside is the case when the file isn't saved already, one has to select the language manually. But in this case, your detection by file extension fails as well anyways.


One thing I didn't get working is having the preview stay at the same position after refresh.
The ScrolledWindow as well as the WebView both were supporting 0 for all positions / widths... Did you get this working?

@maoschanz
Copy link
Owner

maoschanz commented May 2, 2020

To get it working i had to run some javasript in the webview, search "javascript" in preview.py

However i connected the methods to the first random signals that kinda worked, i think there are improvements to do lol

@darkdragon-001
Copy link
Author

Thanks for this idea! Unfortunately, I couldn't find any better signals as well...

@maoschanz maoschanz added the question Further information is requested label Jan 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants