Giter VIP home page Giter VIP logo

xiota / geany-preview Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 0.0 776 KB

Turns Geany into a markdown editor by providing a preview pane in the sidebar to show the formatting of several light-weight languages as they are edited. Supported document types include AsciiDoc, DocBook, Fountain, HTML, LaTeX, Markdown, MediaWiki, reStructuredText, Textile, and Txt2Tags.

License: GNU General Public License v3.0

Makefile 0.91% HTML 7.76% CSS 7.30% C++ 82.70% Meson 1.33%
geany preview markdown markdown-editor asciidoc asciidoctor pandoc html screenplain fountain

geany-preview's Introduction

Preview Plugin for Geany

This plugin provides a preview pane for Geany to view the formatting of several light-weight markup languages as they are edited.

Supported document types include AsciiDoc, DocBook, Fountain, HTML, LaTeX, Markdown, MediaWiki, reStructuredText, Textile, and Txt2Tags.

screenshot

Features

  • The preview is updated as the document is edited
  • HTML, Markdown, and Fountain are supported directly
  • Other document formats can be processed with auxiliary programs
  • The preview of large documents can be limited to the area being edited
  • Rendering of each format can customized with stylesheets
  • Dark and light themes are available

Usage

After installation, enabled the plugin using the Plugin Manager (Tools/Plugin Manager). Since this plugin adds a pane to the sidebar, the sidebar must also be shown (View/Show Sidebar).

The preview will be active by default for documents with supported file types. To display formats other than HTML, Markdown, or Fountain, auxiliary programs are needed. If they are unavailable, no preview will be displayed for their respective formats.

More about usage and configuration is available at Certain Queries Answered.

Installation

Build from Source

Those interested may try Building on Linux. Unfortunately, this plugin does not work on Windows because WebKit2GTK is not available. The plugin has not been tested on Mac.

Arch (and derivatives)

An AUR package is available at aur/geany-plugin-preview-git. Clone the package repository and run makepkg. Then install the package with pacman -U.

git clone https://aur.archlinux.org/geany-plugin-preview.git
cd geany-plugin-preview
makepkg
sudo pacman -U geany-plugin-preview-*.pkg.tar.zst

Ubuntu

This plugin can be installed on Ubuntu from PPA. The files have not been tested with other Debian-based distributions, but may work.

sudo add-apt-repository ppa:xiota/geany-plugins
sudo apt-get update
sudo apt-get install geany-plugin-preview

Requirements

This plugin depends on the following libraries and programs:

Optional auxiliary programs may also be used to process additional formats:

License

The Preview plugin for Geany is licensed under GPL-3.0-or-later.

Some code originated from the Code Format and Markdown plugins, which are written by Michael Brush and licensed under GPL-2.0-or-later.

geany-preview's People

Contributors

xiota avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

geany-preview's Issues

no re-rendering of a visited document when tab-browsing

Actual behavior
When tab-browsing with shortcuts or with the mouse, for example on a html-document, which already has been visited in the Geany session, and with an image on top of the webpage, then I can see a re-rendering in the preview (see the code down below), although there was no change. I can see the webpage re-rendering, because for a part second the text is there where the picture is located.

Expectation
When tab-browsing with shortcuts or with the mouse from one document to another document, the preview should do some kind of hide the preview or keep the preview in memory. So, when the user is tab-browsing back in the editor to the document, the preview should appear right away, so without re-rendering.

Sidebar
The issue appears also when tab-browsing in the sidebar.

Remark
I think this would be a cool a feature. The content of the preview would appear then in light speed.

Test
This is the test-document (a picture named 1.jpg need to be added in the same level of the html-document):

<!DOCTYPE html>
<head>
<title>test</title>
</head>
<body>
<br><br><br><br><br>
<img src="1.jpg" style="width:300px">
<br><br><br><br><br>
<div>1agsjdghjhsgjhgaskdgkagdaksdgaksdgh</div>
<div>agsjdghjhsgjhgaskdgkag2daksdgaksdgh</div>
<div>agsjdghjhsgjhgaskdgkagd4aksdgaksdgh</div>
<div>agsjdghjhsgjhgaskdgkagda5ksdgaksdgh</div>
<div>agsjdghjhsgjhgaskdgkagdaksd6gaksdgh</div>
<div>agsjdghjhsgjhgaskdgka3gdaksdgaksdgh</div>
<body>
<html>

The settings in preview.conf are:
snippet_html=false
extra_css=extra-media.css

add crisscross feature to the shortcut "Toggle focus between the editor and preview"

At the moment the "steps to reproduce" can't be followed because the shortcuts "Toggle editor" and "Toggle sidebar" don't exist inside the plugin. So they are just fictional scenarios.

steps to reproduce

  • editor and sidebar are visible
  • press the shortcut "Toggle editor" (result: now there is only the editor with the highlighted line)
  • press the shortcut "Toggle focus between the editor and preview"

possible result
the highlighted line is not there any more

expectation
the highlighted line should stay in the editor because it makes no sense to let it disappear

possible solution
every time when shortcut "Toggle focus between the editor and preview" is pressed, this should be first executed somewhere in the code of the shortcut "Toggle focus between the editor and preview":
check if "Toggle editor" is active; if yes: don't execute "Toggle focus between the editor and preview"
so, a state file in the shortcut "Toggle focus between the editor and preview" is not necessary

steps to reproduce

  • editor and sidebar are visible
  • press the shortcut "Toggle sidebar" (result: now there is only the sidebar)
  • press the shortcut "Toggle focus between the editor and preview" (result: sidebar is not in focus any more)

for this case, a solution is not necessary, because it could be that someone has a special effect when the webpage is in focus, and the user wants to see the difference between webpage is in focus and not in focus

order of development
before to solve this issue, first #37 and #38 should be solved and checked, because maybe other problems will appear

gray background in the Preview-tab after every restart of Geany

For a part of a second there is a gray background in the Preview-tab after every restart of Geany.
With the help of the software simplescreenrecorder, VLC and colorpicker I could define the exact background color: The background color is #3f4551. It is the same background color like the background color of the tab-title.

It would be great if the background color could be customized, so that the gray background will not be visible any more.
In the editor there is no change of the background color after every restart of Geany.

one-liners for comments in preview.conf

At the moment it seems to be that comments have only a certain number of signs per line to avoid long lines. This behavior has five disadvantages:

  1. pressure for the author to use short sentences, although sometimes long sentences are necessary for a good explication,
  2. harder for the author to edit multi-line comments, because there are some hash-signs between the sentence,
  3. harder for the users to read, because it is not so fluid,
  4. harder for the users to understand, because it is not so good explained, and
  5. harder for the users to copy and paste it in translation tools, because there are some hash-signs between the lines.

If "Line Wrapping" would not exist in Geany, I would understand the use of multi-line comments. But maybe I missed something.

The request for using one-liners should not be used for lists, like for example:

#  - native*      - Use the built-in fountain processor
#  - screenplain  - Use screenplain (slower)
#  - disable      - Turn off Fountain screenplay previews

The idea to avoid multi-line comments was mentioned for the first time in #9 (comment).

Gecko for rendering webpages as option

Because I like to use Firefox, I would prefer that the webpages would be rendered in Geany Preview not with WebKit2GTK but with Gecko. Maybe there could be the possibility to choose the engine in preview.conf. Example:

default     - WebKit2GTK
gecko	    - Gecko (engine of the browser Firefox)
qtwebengine - QtWebEngine (engine of the browser Falkon)
html_render=default

a name of a shortcut is too long

Toggle focus between editor and preview pane.
I would change it like this:
Toggle focus editor/preview

An alternative if my suggestion is not welcome:
Toggle focus between editor and preview

By the way, I would also delete the points from the other two shorcuts, because in the Preferences, in Keybindings, nearly all names have no point at the end.

the content of preview might change its position when tab-browsing in the editor with snippet false

Steps to reproduce

  • open Geany with two documents: one very long txt-document and one very long html-document
  • html-document is in focus
  • close Geany
  • open Geany (result: the content of preview is on top)
  • tab-browse with the mouse or with shortcuts in the editor, and then back to the html-document (result: the content of preview is not any more on top)

Expectation
The content of preview should not change its position during tab-browsing in the editor. It should stay on top.

Remark

  • the issue does not occur with a very short txt-document
  • the issue appears for fountain, html and md
  • the issue is a big problem because it has an impact on issue number 23

Possible solution
When tab-browsing on a document with snippet true, then it does not reset something when tab-browsing on a document with snippet false, and that is why the content is changing its position. Evidence: The issue does not appear when tab-browsing only between fountain-documents and html-documents, both very long, and both with snippet false.

"Loading." for two seconds after every restart of Geany

actual behavior
After every restart of Geany there is for about two seconds the text Loading. in the content of the Preview-tab, even if only one tab is open in the editor, and even there is only one letter in the document, is it txt, md or html.

expectation
It would be good if the content of an open tab would appear faster in the Preview-tab.

possible solution
If Geany is open and then if I open a document like txt, html or md, then the document is shown right away. So the problem seems to be not the rendering. Maybe something does not work properly when Geany is restarted or there is too much to load, like the load of all parsers. So, what about this idea: Geany Preview should do this after every restart of Geany:

  • Load only the parser for the format that is in the editor in the open tab (example: if in the editor in the open tab there is an html-document, then Geany Preview should load only the html-parser).
  • After the load of that specific parser and after the rendering of the Preview-tab, then Geany Preview should load all other parsers in the background, so that in the meantime Loading. does not appear in the content of the Preview-tab.

some questions about geany-preview

I'm interested in geany-preview because I would like to go in webdesign. But before to install geany-preview, I have some questions, to really know if the software fits my needs:

question 1
Can I change the vertical line in the middle of the screen with the mouse, so that the vertical line is more to the left or to the right?

question 2
Does it work exactly like htmlivecode.com where one can see live every change, or do I need first to save the changes to see a preview?

question 3
Is the HTML-Parser in the preview exactly the same like the HTML-Parser in Firefox?

question 4
Is there also a XML-Parser, so I can program in xhtml?

question 5
If there is a XML-Parser, is it exactly the same like the XML-Parser in Firefox?

question 6
If there is a XML-Parser, it is hard to program live in xhtml because it will show many times during coding a kind of mistake-page, so is there the option to show only a preview of the last saving, so I will not have many times a mistake-page?

question 7
Can I have different HTML-documents on the right side, so if I tab-browse on the left side I can see the corresponding preview on the right side?

question 8
I don't understand the two tabs Symbols and Documents on the right side of the picture. For what are they standing?

question 9
How can I disable the preview-area, so that the vertical line and the right side will disappear?

question 10
If a txt-document or a lua-document is shown on the left, I don't need to see a preview on the right side, so what will happen if I tab-browse on the left side between HTML-documents and suddenly there is on the left a txt-document?

question 11
Do I need to use the command (sudo apt pandoc asciidoctor) to see the preview of xhtml-documents?

question 12
Is it planned that geany-preview will be part of geany-plugins?

Thank you for answers in advance.

markdown-documents are not displayed correctly

Create in the editor a document with the name test.md.
Write **hh** in the editor.

Result

  • in the Preview there is this text: **hh**, and it is not bold
  • in the editor there is **hh**, but what is strange: it is bold

In the editor Formiko it shown as it should be:

  • in the Preview hh is bold, and without stars
  • in the editor **hh** is not bold

In the editor ReText, hh is also shown correct in the preview: bold and without stars.

content of the Preview-tab is shaking when editing fountain-documents with snippet_fountain=true

Steps to reproduce

  • In preview.conf: snippet_fountain=true; then Edit, Plugin Preferences, Preview, Reload, Apply, OK.
  • Open a fountain-document like Big Fish.
  • Edit the text in the editor.

Result
The content of the Preview-tab is shaking.

Expectation
The content of the Preview-tab should not shake when editing fountain-documents.

Remark
The content of the Preview-tab does not shake when editing documents in txt, md or html.

the tab-title "Preview" disappears if all other tabs of the sidebar are disabled

Current situation
If, except the Preview-tab, all other tabs of the sidebar are disabled, then there is no "Preview" as tab-title any more.

Expectation
It would be good, if the Preview-tab-title is always visible as default, even if all other tabs of the sidebar are disabled. As option the tab-title "Preview" could be disabled with something like title_preview=false, if all other tabs of the sidebar are disabled.

Possible solution
So, in preview.conf there could be this kind of text:

# title_preview=true*:	tab-title "Preview" is always visible
# title_preview=false:	tab-title "Preview" disappears, if all other tabs of the sidebar are disabled
title_preview=true

Remark
If one use only the tab "Preview", then at the moment there is no visible effect for the tab-title "Preview" when sidebar is in focus (see #5).

add the shortcut "Toggle sidebar" to the plugin

condition
before to start to solve this issue, the shortcut name "Toggle between the editor and preview" should be changed to "Toggle between editor and preview" #34 (comment)

behavior
when pressing 1x the shortcut "Toggle sidebar", only the sidebar should appear
when pressing it again, the only-sidebar-view should not be there any more

tab feature
the shortcut "Toggle sidebar" should have exactly the same tab feature like the shortcut "Toggle focus between the editor and preview", so that users are less disoriented; so, when switching focus from the editor to the sidebar, then the Preview-tab should be in foreground, but when leaving sidebar focus, then the foreground of the tab of the sidebar should not change

  • if the editor is in focus while editor and preview is visible, and if there is an other tab of the sidebar than the Preview-tab in the foreground, then, when pressing the shortcut "Toggle sidebar", the Preview-tab should be in the foreground
  • if only the sidebar is visible, and an other tab of the sidebar than the Preview-tab is in the foreground, then, when pressing the shortcut "Toggle sidebar", the tab of the sidebar should not lose the foreground
  • if the sidebar is in focus while editor and preview is visible, and an other tab of the sidebar than the Preview-tab is in the foreground, then, when pressing the shortcut "Toggle sidebar", the tab of the sidebar should not lose the foreground

I don't think that the tab feature need to be programed. I think that it will work automatically when focus feature will work.

focus feature
the shortcut "Toggle sidebar" should have exactly the same focus feature like the shortcut "Toggle focus between the editor and preview", so that users are less disoriented

  • if the editor is in focus, and when pressing the shortcut "Toggle sidebar", the content of the Preview-tab should be in focus
  • if the sidebar is in focus, and when pressing the shortcut "Toggle sidebar", then the highlighted line should appear in the editor, on that place where it was the last time

Maybe the focus feature could be solved with copy & paste of a part of the code of the shortcut "Toggle focus between the editor and preview", because they have both exactly the same focus feature.

crisscross feature
a state file would be good, so that interactions between the shortcut "Toggle sidebar" and the shortcut "Toggle editor" are possible, so that when pressing "Toggle sidebar" and then "Toggle editor", or vice versa, that no empty Geany appears;
so, if "Toggle editor" is active, then first de-activate only-editor-view

alternative
as long as the shortcut "Toggle sidebar" is not part of the plugin, the toggle-editor-scripts can be used (https://github.com/xiota/geanylua-scripts); but the scripts don't offer all the features above

name of the shortcut
In Geany there is the shortcut "Toggle Sidebar". This makes sense, because in Geany the editor is the center while other tools are some kind of accessories, what can be enabled and disabled. But in the plugin Geany Preview the center consists of two items: editor and preview. So, here we have a completely other starting point. Now, before pressing a shortcut in Geany Preview, users have a clear vision of the final result in them heads. And the final result is to see only the sidebar. And that is why the shortcut should be called "Toggle sidebar" and not "Toggle editor", even if it is about disabling and enabling the editor.
By the way, the possible shortcut "Toggle editor" inside the plugin, would correspond to the shortcut "Toggle Sidebar" in Geany, because the final result is to see only the editor, even if it is about disabling and enabling the sidebar.

history
this issue is a continuation of xiota/geanylua-scripts#4

reasons for adding the shortcut to the plugin
I think that the three shortcuts "Toggle focus between the editor and preview", "Toggle Sidebar" and "Toggle editor" are important shortcuts in Geany Preview. And also because they don't need to be personalized, they should be inside the plugin (the shortcut "Toggle focus between the editor and preview" is already part of the plugin). And I think that the shortcut "Toggle sidebar" is easier to develop and to maintain than outside Geany Preview (see down below "possible order of development"). And users will benefit of options that work out of the box.

possible order of development
I think that it is easier to develop first the shortcut "Toggle editor" #38 and then this shortcut, because then somehow the development of this shortcut is something like a copy & paste work (the code for focus feature can be copied from the code "Toggle focus between the editor and preview" ", and the code the for the crisscross feature can be copied from the code of the shortcut "Toggle editor").

when zooming: don't show scrollbars when not needed

If I zoom in the content-area of the Preview on a touch-device, then there are scrollbars even if scrollbars are not necessary. In the browser Falcon that uses the same engine like Preview, when zooming then there are no scrollbars when no scrollbars are necessary.

empty preview for html and markdown

Preview works perfect with txt-documents and with fountain-documents. But for html-documents (with or without DOCTYPE) and markdown-documents the Preview-tab is completely empty since the introduction of pandoc.css in the preview-file. Even if I double click in the Preview-tab, nothing happens. Same for extra_css=extra-media.css and extra_css=disable in preview.conf. If I restart Geany with an html-document or an md-document, then there is in the light theme in the Preview-tab for about 2 seconds "Loading.". And then there is nothing.

For conf-documents there is this text in the Preview-tab: "Unable to process type: Conf, UTF-8.".

html-document and md-document
If I right-click in the Preview-tab to select in the context menu "Reload", then the document appears in the Preview-tab. It works only for the single Preview-tab, so not for other html-documents and not for other md-documents at the same time. I have to do that every time I restart Geany. But if I change the tab in the editor and switch back to the tab, then Preview-tab is completely empty again. If I change the code of one html-document or one md-document in the editor, so for example if I just type one letter, like "t", then Preview-tab is completely empty again.

md-document
For md-documents it is even worst. Visit #8.

This is what I did to make a kind of reset:

  • I closed all tabs except html-tabs in Geany
  • then I closed Geany
  • I deleted xitweaks.conf
  • I deleted preview.conf and all css-documents in the file preview
  • I deleted geany.css

Same problem like before.

This is the test-document in html:

<!DOCTYPE html>
<html>
<head><style></style></head>
<body>
<p>This is a test.</p>
</body>
</html>

Intermediate solution to see something in the Preview-tab

  • add the code below at the end of preview.conf
  • save the document
  • in Edit, in Plugin Preferences, in Preview, click on Reload Config, Apply and OK.
html_processor=pandoc
markdown_processor=pandoc

Then for all html-documents and for all md-documents there is now content in the Preview-tab, as it should be, but the content appears a little bit slower then it should be, what I can see when I restart Geany with an html-document or an md-document: In the light theme in the Preview-tab for about 2 seconds there is this text: "Loading." before the content appears in the Preview-tab.

add the shortcut "Toggle editor" to the plugin

condition
before to start to solve this issue, the shortcut name "Toggle between the editor and preview" should be changed to "Toggle between editor and preview" #34 (comment)

behavior
when pressing 1x the shortcut "Toggle editor", only the editor should appear; the highlighted line should be there
when pressing it again, the only-editor-view should not be there any more; the highlighted line should be there

reasons for adding the shortcut to the plugin
because the shortcut "Toggle Sidebar" of Geany does not have a state file, it is necessary to add the shortcut "Toggle editor" to the plugin (the shortcut "Toggle Sidebar" would correspond from the handling to the shortcut "Toggle editor" of Geany Preview), in order to add a state file, so that xiota/geanylua-scripts#3 and the crisscross feature down below can be solved

focus feature
always after pressing the shortcut: the content of the editor should be in focus, so the highlighted line should be there;
this feature is not necessary to program, because it works perfect at the moment with the shortcut "Toggle Sidebar", that would correspond to the shortcut "Toggle editor" in Geany Preview

crisscross feature
when pressing "Toggle sidebar", first the state file of the "Toggle sidebar" need to be checked;
so, if only-sidebar-view is active, then first de-activate only-sidebar-view

name of the shortcut
see explication in "name of the shortcut" in #37 (comment)

autoside-bar
this issue should also keep an eye on this issue xiota/geanylua-scripts#3;

  • if only-editor-view is active, then deactivate auto-sidebar
  • if only-editor-view is going from active to de-active, then activate auto-sidebar

when closing Geany
if only-editor-view is active:

  • then deactivate only-editor-view, so that after a restart of Geany, editor and preview are side-by-side
  • activate auto-sidebar, so that after a restart of Geany, auto-sidebar is active

add zoom shortcuts to the Preview

Ctrl++
Ctrl+-
Ctrl+0

I think that the shortcuts should work when the sidebar is in focus.
But I think the best would be that the shortcuts should work when the content-area of the Preview-tab is in focus, what is hard to determine at the moment.
It could be that the shortcuts are easier to program with Lua Scripts.

when sidebar is in focus: visible effect of the tab

It happened to me already many times that I lost the orientation when working with shortcuts in Geany because I didn't know which pane is now in focus: editor or sidebar.

Let's imagine this situation: A document, that is already saved, is longer than the visible area. The current line is on top of the document. With the mouse the user is scrolling down, so that the current line is not any more in the visible area. Now the user is distracted by something. Then the user looks back on the screen. What is in focus? Is it the editor or Preview? There is no hint at all. Now let's imagine the same situation with visible effect of the tab when sidebar is in focus. Now there is a hint: Because the Preview-tab has no visible effect, it means that the editor is in focus.

So, that were my thoughts today:
An other background-color for the tab would be good. Or an other font-color. Or what about a kind of star-symbol after the word Preview? A symbol after the word Preview could be interesting but I don't like when there is an addition, because it is not minimalist. What if the font-color is the same font-color like the font-color of the unsaved tab in the editor? Yes, but in Preview there is nothing like "unsaved". So there should be different colors for a clear separation. So, what about if the font-color would be in green? Hey, that sounds good! A kind of soft green color. The green color reminds me of a traffic light when people are crossing the street. A color reminds me of children, because children like to play with colors. Colors reminds me also of a toy to play. Yes, and coding is playing. All those point of views make so much sense. So I have a good feeling for the green color as font-color when the Preview-tab is in focus. But maybe I will not like the effect.

Is there a possibility to change the font-color of the Preview-tab when it is in focus? If so, where can I change the settings?

Nevertheless I think that the idea of a green font-color is a good idea. The Preview-tab would have then, when it is in focus, some kind of smiling, warm and lovely character. Or what about this idea: When Preview-tab is in focus, then the font-color should be green by default, and at the same time giving the users the possibility in a script to change the font-color?

What about #46af41?
#46af41: I found this color today by pressing in the color spectrum in Gimp.
I tested the color in the tab of the editor for unsaved tab. I like it.

On one side there is the red color for the unsaved tab in the editor, and on the other side there would be the green color when Preview is in focus or when other tabs of the sidebar are in focus. It would be some kind of nice color game that fits together.

missing snippet definition for fountain in preview.conf

There is only a snippet of fountain in the Preview-tab, although there is no definition for fountain in preview.conf, like snippet_fountain = true. To turn snippet_screenplain=true to snippet_screenplain=false does not change the situation.

the release of a click on the tab-title should put the content of the tab in the focus

actual behavior
If I click on a tab-title of the sidebar: The tab-title is in focus, even if the mouse-key is not pressed any more. Evidence: There is no sign for it, but both tests below are negative.

control tests with a very long html-document, and with at least two tabs in the sidebar:
TEST 1: Open Geany, click on the Preview-tab-title, then press the arrow-left-key only once: the content of the Preview-tab should still be in focus.
TEST 2: Open Geany, click on the Preview-tab-title, then press the arrow-down-key only once: the html-document should move downwards.

expectation

  • The tab-title of Preview should be in focus as long as the mouse-key is pressed, but in the moment where the mouse-key is not pressed any more, the content of the Preview-tab should be in focus.
  • It should work for all tabs of the sidebar.

remark
The tabs in the sidebar should work exactly like the tabs in the editor: Open Geany, click on a tab-title of the editor and hold the mouse-key for about 10 seconds: tab-title is in focus, but in the moment where the mouse-key is not pressed any more, the content of the tab is in focus, and not the tab-title of the editor, what is visible with the highlighted line.

empty Preview for fountain

When html and md was not displayed in the Preview-tab (#9), fountain was displayed in the Preview-tab. Since issue number 9 was fixed, it is the other way around: html and md are displayed in the Preview-tab, but not fountain any more.

Fountain can be displayed with a right-click in the Preview-tab, then select in the context menu "Reload". This has to be done each time,

  • when changing one word in the editor,
  • when switching tabs, and
  • after restarting Geany.

Dark mode for plain text and "Unable to process type" message.

I would like to change in the Preview-tab the white background of txt-documents.

In those documents there is the text "Unable to process type" with white background. Could it be that a change of the background-color in Preview is not possible for those documents?

Fountain-text in the Preview all in white as default

I think that two years ago all text in the Preview was in white when using dark mode. According to xiota/geanylua-scripts#5 (comment), since last year some text is white and some text is black. The black text is hard to read.

I replaced in fountain.css this code:

/* Slug */
Dialog {
	break-inside: avoid;

by this code:

/* Slug */
Dialog {
	color: white;
	break-inside: avoid;

Now all the text in the Preview is in white.

What about the idea to add the line color: white; in fountain.css as default?
An alternative would be maybe color: yellow;, to give users a help where to change the color of dialogs.

I would also replace this code:

html {
	font-size: 8pt;
}

by this code:

html {
	font-size: 8pt;
	color: white;
}

It would be easier for users who have problems with CSS to know where to change the color for the rest of the text.

a blinking vertical line in the Preview only for visible text as option for html

If the issue #19 can be solved, then this issue could be interesting: A blinking vertical line in the Preview to show the position of the cursor of the editor, for all the code or only for visible text. Example: If in the editor the cursor is just before the body-tag, then the blinking vertical line should not appear in the preview, if in preview.conf the setting is blinking_vertical_line_for_visible_text_html=true. With the setting blinking_vertical_line_for_visible_text_html=true the blinking vertical line should also not appear for text with the css visibility: hidden or display: none.

The default settings in preview.conf could be something like this:
blinking_vertical_line=false
blinking_vertical_line_for_visible_text_html=true

tab-browsing in the sidebar does not work properly

remark
It is an old issue, that was fixed, but now it is again an issue. The issue was mentioned for the first time in issue number 5 ("when sidebar is in focus: visible effect of the tab"). But I recognized now, that the issue "tab-browsing in the sidebar does not work properly" has nothing to do with the issue number 5. And that is the reason why I just opened this issue.

open Geany with an html-document
condition 1: the editor is on the left side; the sidebar is on the right side
condition 2: the Symbols-tab is in the sidebar the first tab
click on the Preview-tab
close Geany
open Geany
press the shortcut toggle editor/sidebar
in the sidebar: tab-browse with shortcuts to the left (Ctrl+Page-up), to the first tab of the sidebar, so to the Symbols-tab
in the sidebar: continue to tab-browse with shortcuts to the left (Ctrl+Page-up)
result: a tab of the editor is in focus
expected result: the last tab on the right side of the sidebar should be in focus

add the shortcut "Toggle between editor and sidebar" to the plugin

reasons
Because of #20, editing a long HTML-document, the change will not directly appear in the Preview, it could be better that some users want to code in the only-one-view-modes, so only-editor-view or only-sidebar-view. For this situation, two shortcuts would be needed, "Toggle sidebar" #37 and "Toggle editor" #38 (that both don't exist at the moment inside the plugin). But one shortcut would be better. Two other situations where it could be also useful: 1) webpage that has a big width, and 2) because maybe one don't want to be distracted by the Preview while typing.

entering
It should start what was in focus just before pressing the shortcut, but only if the only-view is not already active. If the only-view is already active because for example the shortcut "Toggle editor" was pressed just before, then the counterpart should be shown (so, to stay in this example, if in the only-editor-view the shortcut "Toggle between editor and sidebar" is pressed, then after pressing the shortcut, the only-sidebar-view should appear). That means that the state file of the two shortcuts ("Toggle sidebar" and "Toggle editor") need to be checked first, if there are active, and if one of them is active, then the one should be de-activated.

leaving
The exit of the loop would be possible with the shortcuts "Toggle editor" or "Toggle sidebar".
Example:
If the only-sidebar-view is active, and if the shortcut "Toggle editor" is pressed, then "Toggle editor" need to be pressed 2x, to see editor and preview side-by-side.
If the only-sidebar-view is active, and if the shortcut "Toggle sidebar" is pressed, then editor and preview will appear side-by-side.
For the leaving-scenarios the state file of the two shortcuts "Toggle editor" and "Toggle sidebar" need to be extended, because they need to check first if "Toggle between editor and sidebar" is active. That means that a state file for the shortcut "Toggle between editor and sidebar" should exist.

documentation
It should be mentioned in the documentation, for example on https://github.com/xiota/geany-preview/blob/main/docs/CQA.md, that in case the shortcut "Toggle between editor and sidebar" was set, but neither for "Toggle editor" nor for "Toggle sidebar" a shortcut was set, the ways how to leave the only-view is, a) by restarting Geany, or b) that this need to be done first: set a shortcut either for "Toggle sidebar" or for "Toggle editor", and then press 1x or 2x the corresponding shortcut.

overview
This would be the possible list of the shortcuts for the navigation between editor and sidebar inside the plugin:
Toggle focus between editor and sidebar (the shortcut already exist in the plugin) #4 #34 (comment)
Toggle sidebar #37
Toggle editor #38
Toggle between editor and sidebar (this issue)

development
First #37 and #38 need to be solved, then the solutions need to be checked for some weeks, before to start to solve this issue, because it could be that new problems will appear.

XHTML-document does not appear in the preview

Geany Preview uses WebKit. The browser Web (https://wiki.gnome.org/Apps/Web) uses also WebKit. In the browser Web I can see the content of the document index.xhtml, but not in Geany Preview.

The content of index.xhtml:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>homepage</title>
</head>
<body>
	<div>some content here...</div>
</body>
</html> 

It seems to be that Geany Preview has no XML-parser.

content of the Preview-tab might shake when snippet is set to false for fountain, md and html

Conditions:

  • snippet_html=false
  • without a background color in the html-code
  • very long document

Test 1

  • open Geany
  • open the very long html-document
  • click in the editor and then press Ctrl+home
  • in the Preview-tab: place the scrollbars on top of the document
  • close Geany
  • restart Geany
  • type text extremely fast at the top of the document within a div-tag

Result: There is no shaking.

Test 2

  • open Geany
  • open the very long html-document
  • click in the editor and then press Ctrl+end
  • in the Preview-tab: place the scrollbars on top of the document
  • close Geany
  • restart Geany
  • type text extremely fast at the end of the document within a div-tag

Result: There is no shaking.

Test 3
Do the same like Test 2, but before to type in the editor:

  • in the Preview-tab: scroll with the scrollbars to the end of the document

Result: The content of the Preview-tab is shaking. I think why it is shaking: Because for a part of a second, I can see the top of the webpage. So, it seems to be that it shows first the top of the webpage and then the actual part of the webpage with the change.

Possible solution
Show the content in the Preview after rendering and after the content is fixed.

a blinking vertical line in the Preview to show the position of the cursor of the editor

Steps to reproduce

  • Open a fountain-document like Big Fish.
  • Click right away in the middle of the editor within the text.

Result
It takes time to know where the highlighted line of the editor is located in the Preview-tab.

Expectation

  • A blinking vertical line in the Preview as eye-catcher.
  • The blinking vertical line should be in the text of the Preview at the same position like the cursor in the text of the editor.
  • The blinking vertical line should be from its visual effect like the cursor in the highlighted line of the editor.
  • The blinking vertical line should have the same font-size like the symbol before the eye-catcher.

Options
In preview.conf there should be the possibility

  • to enable the eye-catcher when the editor is in focus (with true)
  • to enable the eye-catcher when the sidebar is in focus (with true)
  • to enable the feature for each format (with true)

The default settings should be false. So, with the appropriate settings the user has then four options:

  1. no eye-catcher
  2. eye-catcher when the editor is in focus
  3. eye-catcher when the sidebar is in focus
  4. eye-catcher when the editor or the sidebar is in focus.

So, a user who is using either the second or the third option has then the possibility to disable the eye-catcher for example by using the shortcut toggle editor/sidebar.

Context
The feature could be particularly interesting when there is a lot of text without empty lines and without paragraphs. Then the eye-catcher could be a useful help for orientation.

show a visible change in the visible area of the Preview-tab

Conditions
1: In preview.conf: snippet_html=false
2: A very long html-document where on need to scroll in the Preview-tab and where there is in the editor a lot of text within one single p-tag.

Steps to reproduce
1: scroll with the scrollbars of the sidebar to the bottom of the web-page
2: add in the editor one letter at the beginning of the p-tag

Result:
The change is not in the visible area of the Preview-tab. To see the change one need to scroll in the Preview-tab to the top.

Possible solution
Geany Preview should do something like this: If the visible change is not in the visible area of the Preview-tab, then put the visible change in the visible area of the Preview-tab, if possible at the same level like the highlighted line.

Remark
What I mean with "show a visible change": Not all changes of the editor should be shown in the visible area of the Preview-tab, but changes in the Preview-tab that can be recognized by a person. So, for example if there is a long html-document and the user is adding at the very end of the document an empty div-tag, then Geany Preview should not execute "show a visible change in the visible area of the Preview-tab". Same for div-tags with visibility: hidden or display: none. If this is not possible to realize, then "show a change" is the alternative.

empty preview for txt-documents as option

The preview of txt-documents shows nearly the same content like the content of the editor. One option is the auto-sidebar to hide the preview of txt-documents (mentioned in issue number 1). But maybe some users will not like that the vertical line between editor and preview appears and disappears while tab-browsing. So, another option could be to show a completely empty preview, with something like empty_preview_for_txt=false as default setting in preview.conf. The setting empty_preview_for_txt=true would then show a completely empty preview. Personally, I think that I would use it sometimes as variation.

sometimes the context menu of the Preview-tab does not work properly for HTML-documents

restart Geany with an HTML-document with a link inside the code, so an a-tag (something like this: a href="...")
in the preview-tab: click on that link, wait till the new webpage appears, then right-click on an empty place within the webpage
result: "Back" can not be selected in the context menu, although there should be the possibility to select it

change the internet address in href
save the document
go to the preview-tab: click on that link, wait till the new webpage appears, then right-click on an empty place within the webpage
result: this time "Back" can be selected in the context menu

HTML: the content of the preview is shaking one time when typing in the editor

condition
snippet_html=false
long text, so there is a scrollbar in the preview
Document>Line Wrapping

steps to reproduce
1: in the preview-tab: place the scrollbar in the middle
2: in the editor: go at the end of the HTML-document and type some text

result
there is one time a shake in the preview-tab

expectation
there should be no shake in the preview-tab

Add libpodofo-dev to build dependencies

I just built geany-preview on Debian Sid. Installing the build requirements pulled in libpodofo0.9.8 as a dependency. However, I found that I needed to install libpodofo-dev for configure to complete. After that, it compiled without error.

no reset of the zoom and no change of the position when editing

zoom
On touch devices if I zoom in the Preview, then there will be a reset of the zoom of the Preview when editing in the editor. There should be no reset of the zoom.

zoom & position change
If in the browser Falkon I zoom in, and then if I change the position of the visible area by moving the HTML-document with the fingers, an then if I change the HTML-document in an editor and save the document, and then if I reload the HTML-document in the browser Falkon, then there is no reset of the zoom and there is no change of the position of the visible area. This should be the same in the Preview.

preview should not execute html-code of txt-documents

Steps to reproduce
Add the following code in a txt-document somewhere on the first page:

<body style="background:gray">

Result: The background of Preview is gray.

Expectation
Preview should not execute html-code of txt-documents. In the browser Firefox and in the browser Web html-code of txt-documents is not executed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.