dullage / flatnotes

A self-hosted, database-less note taking web app that utilises a flat folder of markdown files for storage.
MIT License
1.5k stars 87 forks source link

Style issues with code blocks #162

Open Bag72 opened 9 months ago

Bag72 commented 9 months ago

Great product. I use it for storing all my Lab Notes.

Only thing is that I just spent ages diagnosing a stupid problem because I forgot that Markdown hides text in <> and I pasted into Apache some information not realising that I had missed one out. The WYSIWYG or Markdown tabs filter them out.

I do use markdown more than plain text but could we have a tab for just plain text or a button at the top with the inline code and Code block buttons that will not format anything within them. That seems to me to be an easy solution and would help people like me.

I'm assuming that others hit this problem as well.

Any thoughts?

dullage commented 9 months ago

Hi @Bag72, glad you like it. Can you please give me an example of what you're pasting.

Bag72 commented 9 months ago

Hi, I paste the following into the page.

chown -R $USER:$USER /var/www/[domain]
nano /etc/apache2/sites-available/[domain].conf
 <VirtualHost *:80>
    ServerName <domain>
    ServerAlias www.<domain>
    ServerAdmin admin@<domain>
    DocumentRoot /var/www/<domain>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
 </VirtualHost>

a2ensite [domain]
a2dissite 000-default
apache2ctl configtest
systemctl reload apache2

Which is instructions for configuring my site in Apache.

If I go to thee page and copy what is visible I get

nano /etc/apache2/sites-available/[domain].conf

ServerName 
ServerAlias www.
ServerAdmin admin@
DocumentRoot /var/www/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

a2ensite [domain] a2dissite 000-default apache2ctl configtest systemctl reload apache2

In this case it is easy to see something is missing in server , server alias etc. but what? If I edit the page I can see, and copy, the original. My concern is if it is something less obvious that something is missing and a third party just cuts and pastes. I did it myself on something else because I normally put variables to be changed in <> Such as in the example above /var/www/ as /var/www/ is perfectly valid. It does the same in Markup or WYSIWYG.

To be honest this is my only real issue with the app. Nice and simple, easy to set up and use and although it could be improved by the addition of folders (hint, hint) this is the only real issue I have.

Bag72 commented 9 months ago

That was a pain. Apologies for the bold and formatted text above. It won't allow me here either. I've tried editing it three time with quotes and code etc. until it worked.

<VirtualHost *:80>
    ServerName <domain>
    ServerAlias www.<domain>
    ServerAdmin admin@<domain>
    DocumentRoot /var/www/<domain>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
dullage commented 9 months ago

Thanks for the example. My initial thought was that code blocks are there to solve this problem and so should work. But I can see now that, even within a code block, some elements are still hidden.

This seems to be down to the syntax highlighting plugin I'm using as with that disabled, there doesn't seem to be a problem. You can see yourself on the demo page for the embedded editor flatnotes uses, Toast UI Editor. If you toggle between "Basic" and "With All Plugins" you can see that, when using "Basic", the example renders fine (within a code block).

No Plugins

image

Plugins

image

I did find that if you specify the language as XML or HTML then you do see what was hidden.

Plugins + Language Specified

image

That said, in flatnotes, with the custom stylesheet I use, although still visible, it looks a little rough.

flatnotes + Language Specified

image


This is all to say, there are some workarounds but there is certainly an issue here. I'll log it as a bug and try and take a look when I get a chance.

Bag72 commented 9 months ago

I'll play with the plugins myself to set up the workaround.

Appreciate you time. Thank you very much again.