Giter Site home page Giter Site logo

secure-77 / perlite Goto Github PK

View Code? Open in Web Editor NEW
889.0 11.0 74.0 72.67 MB

A web-based markdown viewer optimized for Obsidian

Home Page: https://perlite.secure77.de/

License: MIT License

JavaScript 8.22% CSS 68.30% PHP 22.52% Dockerfile 0.12% Shell 0.31% Python 0.52%
obsidian parsedown markdown perlite

perlite's Introduction

perlite's People

Contributors

catrone3 avatar chmac avatar knorr3 avatar lennartbrandin avatar secure-77 avatar selfiens avatar shardbyte avatar stellarix avatar tooa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

perlite's Issues

Multiple links on same line treated as one.

If multiple wikilinks are on the same line they are treated as one.

For example if the source file contains:

incoming: [[foo]] and [[bar]] with [[../baz]]

now including! [[foo | Alias]] and [[bar | Alias2]]

This is rendered like so:
image

To Reproduce
Add multiple wikilinks on the same line in any markdown file.

Expected behavior:
Links are rendered separately.
image

Proposed fix
The problem seems to be in content.php on the lines 91 and 95.
The Regex there looks for [[ and ]] pairs with any characters (.*)- in between.
If the content of the link would exclude the characters [ and ] (these are not allowed in obsidian filenames anyways) the links would be terminated correctly.

I suggest replacing the (.*) part with something like ([^\[\]]*)

Latex math not being rendered correctly

Hello, I just uploaded my notes to my Perlite website and I'm having some issues rendering math.

For example
Screenshot from 2022-11-28 22-48-54

image

Vs how it appears in obsidian locally

image
image

image

I believe the boxes are from a plugin I have installed but why do the equations and image aren't rendering correctly? Also, is there a way to make my locally installed plugins work on the website? Thanks in advance!

Source code:

> [!todo] Definition
> Given two bit-strings $x, y ∈ {0, 1}^n$  we define their product $x · y ∈ {0, 1}$ as:
> $$x · y = (x_1 ∧ y_1) ⊕ · · · ⊕ (x_n ∧ y_n)$$

> [!note] Lemma 2
> For any three binary strings $x , a, b ∈ {0, 1}^n$ the equation $(x · a) ⊕ (x · b) = x · (a ⊕ b)$ holds

> [!note] Lemma 3
> For any element $|b⟩$ in the computational basis of $C^2$ we have 
> $$H |b⟩ = \frac{1}{\sqrt{ 2 }} \sum_{z \in 2} (-1)^{b \land Z}|z⟩$$

> [!summary] Theorem 1
> For any element $|b⟩$ in the computational basis of $C^{2^n}$ we have 
> $$H^{⊗n} |b⟩ =\frac{1}{\sqrt{ 2^n }}  \sum_{z \in 2} (-1)^{b \cdot z} \ket{z} $$

> [!example] Example of Theorem 1
> For $n=1$ and $b=\ket{0}$ for example:
> $$
> H \ket{0} = \frac{1}{\sqrt{ 2 }} ((-1)^{0 \cdot 0} \ket{0})  + (-1)^{0 \cdot 1} \ket{1}) = \ket{+}  
> $$
> > [!caution] How the dot product works
> > $0 \cdot 0 = 0$
> > $0 \cdot 1 = 0$
> > $1 \cdot 0 = 0$
> > $1 \cdot 1 = 1$
> > 
> > Now what happens when we have **multiple qubits?** 
> > If $b$ is an multi qubit state..
> > 
> > $b_{1} \cdot z_{1} \oplus b_{2} \cdot z_{2} \oplus \dots$


- [ ] Prove theorems/lemmas, specially theorem 1 🔼 #Universidade 

# The Problem

> [!info] The Problem
> Take a function $f : \{0, 1\}^n \rightarrow \{0, 1\}$.
> You are promised that $f (x) = s · x$ for some fixed bit-string $s$. 
> Find $s$


Classically, we run $f$ $n$-times by computing

$$f (1 . . . 0) = ({\color{orange}s_1} ∧ 1) ⊕ · · · ⊕ (sn ∧ 0) = {\color{orange}s_1}$$
$$\dots$$
$$f (0 . . . 1) = (s1 ∧ 0) ⊕ · · · ⊕ ({\color{orange}s_{n}} ∧ 1) = {\color{orange}s_{n}}$$

Quantumly, we discover $s$ by running $f$ only $\color{orange}\text{once}$

Headers Hyperlink inside a Document

Obsidian Supports references toward Headings inside a document:

[[Document#Heading1]]

Which is use full for large markdown documents.

These Links seems to break in Perlite, showing empty pages.

Note: This feature is competing with outline view of documents.

Having issues with Docker

Hi, I really like what this project is attempting to do, and have been trying to set it up using docker.
Unfortunately, it looks like the perlite_web container isn't available on dockerhub anymore, so the example docker-compose doesn't work.
Don't know if this is a docker-compose versioning thing or something, but my docker-compose errors out on the 'volumes_from' arg in the docker-compose.yml, and says to use volumes and share the vol's between containers.

Any help getting this set-up would be much appreciated!

Links to notes in another folder don't generate the correct URL.

Describe the bug
Auto generated links do not properly generate URLs for MD files in different folders. You end up with a URL that has the same folder as whatever file contained the link, with the target file in the URL. For example I click a link in a file inside the "apps" folder and the target is "samba" inside the "linux" folder but the URL ends up like this: ?link=%2Fapps%2Fsamba

To Reproduce
Steps to reproduce the behavior:

  1. Add a link to a MD file in another folder.
  2. Click on the link in the perlite web page
  3. See the blank note page and notice the incorrect folder in the URL.

Expected behavior
The link should take you to the folder of the target file, not the folder containing the link.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome

Make Graph View Toggleable via Left Sidebar

Is your feature request related to a problem? Please describe.
If Graph View is enabled, then the only way to close Graph View is by clicking on the 'x' button. Clicking the Graph View button again or navigating to a different file in the vault do not close Graph View. In Obsidian, you can exit Graph View by navigating to a file.

Describe the solution you'd like
Making the Graph View button toggleable so clicking it again would close the Graph View. Navigating to a different page from within Graph View would also close Graph View.
This would be a much more intuitive UX.

Any plans to add the graph?

First of all thank you for making this. It's the only one I have found that will work on shared hosting. I am very appreciative 🙏🏾

Are there any plans to add a way to share the graph view? There is another project called Pubsidian which has this, and there is also a wordpress plugin called Post Network to gather some ideas for implementation.

Thank you for considering.

Environment Variables for Line Breaks and Other Styling

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I wanted to enable strict line breaks in a Docker install of Perlite.

Describe the solution you'd like
A clear and concise description of what you want to happen.

It would be useful if there were environment variables we could use to change these behaviours instead of having to edit the php files.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Installed the Docker image to a local volume and used a text editor to change the files. This is an imperfect solution because it would be overwritten upon future updates. Environment variables would be a much better in the long run.

Additional context
Add any other context or screenshots about the feature request here.

Not using docker, website detects no linked mentions

Hello there,
First of all, great project! Fantastic work pulling this all together.

I'm trying to run it on a server of mine without docker, I pointed an apache server to the perfile directory and put the Demo vault in there. The website runs just fine but it doesn't detect any linked mentions between documents. Any idea why that is?

The image is exemplifier of the problem:

image

Three questions in README.md & New "helper.php"

  1. In README.md the line 92
    coverage
    it should be:
    coverage

  2. And when I use the new "helper.php" you provided me yesterday, the "about" button fails.

  3. At present, it is not possible to support LaTex language input formulas, and I hope to add related functions

change of the URL, when you click on a seperate file in the menu

I need to implement and test this

Addition in perlite.js

function changeURL(str){
  window.history.pushState({},"", "/?link="+str);
  getContent(str);
}

Change in helper.php -> menu function

$html .= '		<li>
                                    <a href="#" onclick=changeURL("'. $pathClean .'"); id="'. $pathID .'" class="perlite-link">'. $mdFile .'</a>
                                </li>';

Originally posted by @gigibu5 in #10 (comment)

Add Support for Mermaidjs

Obsidian supports "some" version of Mermaidjs. The code below is a proof of concept of adding the feature.

https://github.com/secure-77/Perlite/blob/main/perlite/Parsedown.php#L446

$class = 'language-'.$language;
if ($language === 'mermaid') { $class = 'nohighlight '. $language; }

https://github.com/secure-77/Perlite/blob/main/perlite/index.php#L31

<script src=".js/auto-render.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad:false});</script>

https://github.com/secure-77/Perlite/blob/main/perlite/content.php#L97

// hide title
$content = '<div class="mdTitleHide" style="display: none";>'.$cleanFile.'</div>' . $content;

// mermaidjs code
$content = '<script>mermaid.init(undefined,document.querySelectorAll(".mermaid"));</script>'."\n". $content;

Support Callouts

Hi 👋,

one of the recent Obsidian releases introduced callouts. I use them a lot in my vaults and I would really love to see them supported in Perlite. I don't think the first implementation has to be too fancy. Rendering all different callout types (WARNING, INFO, etc.) the same way is fine for my use case.

Right know, defining a callout in Obsidian as follows:

> [!WARNING] A Title
> Contents

renders as (tested on c757c66)

image

Proposals

I don't think that parsedown supports callouts as it seems like a custom thing - especially the syntax. Maybe we can render them a different way then?

Render as Block-quotes

image

This example shows that this should actually work already.

Render as Markdown

image

Notes

I would like to express my gratitude to you. Perlite works really well and the Docker deployment helps a lot to spin it up in zero time.

Add outline for documents

Hi 👋,

I would like to see an outline per page added to Perlite. The outline can be rendered on the right side of each document. One could switch via a button between displaying the graph or the outline.

Let me know what you think about it. Thanks for considering this enhancement.

Can´t open settings after clicking an image

There is a Bug in version 1.5.3 (and probably 1.5.x also)

If you click on an image it will open a modal window, after this you need to reload the page first before you can enter the fronted settings, otherwise the latest opened image will be loaded.

I need to create a dedicated modal window for the images

Regression: callouts render as regular block quotes

Describe the bug

Obsidian callouts render as regular block quotes after the upgrade to Perite 1.5. This is a regression issue since the feature was being introduced in #26 (original feature request).

To Reproduce

  1. Go to https://perlite.secure77.de/?link=%2FDemo%20Documents%2Fmarkdown-sample3
  2. Observe regular block quote styling rather than callout formatting

Expected behavior

  • Callouts render at least with accent color depending on their type
  • Optional: Callouts render with their dedicated icon
  • Optional: Callouts can be folded

Desktop (please complete the following information):

  • OS: Linux
  • Browser: Firefox 106.0.2 (64-bit)

Popup Quick reference

As I'm a real lover of Perlite, I'm thinking of ways to make it what is already better than others, even better.

Premise: It's hard to make people read, don't get them stuck in a maze when they finally accept to start.

In thought of making notes flow, I thought it could be great to have contextual information as ''hyperlinked text'' inside a document.
If I'm not mistaking, obsidian does not support anything like that. (that I know of)

The structure.
A hidden folder within the vault containing quick definitions of words:
.words/
-Browser.md
-Shellcode.md
-Anything.md

Let's then suppose you want the text to flow and let the reader go through the opened document without too much distraction:

Important information

Part1

First you will have to understand that everything you will do will be in your [[Browser]] and no where else. Make sure you understand what [[Shellcode]] throughout this procedure, and never stop reading this document until it's finished.

......
.....

For example when the user will click
[[Shellcode]]
Instead of jumping to the .md file , it could open a closable popup window (just like the (?) icon a the bottom of perlite which is a mardown file!!!!)

image

It looks like lots of things are already there in the php to achieve this but the concerns are:

  • Of course the ''popup links'' cannot alter the normal [[ link ]] behavior. So something should be added in order for Perlite to recognize the reference as a <> and not jump to the document.
  • Also this special action should not interfere with obsidian documents. Ideally this special ''character'' or anything to make it work, should not be visible in the readable obsidian original, but I guess I might be pushing a bit far.

I believe this kind of tool could really help picking up really unadvanced users and help them hop along without slowing down having to explain what a [[Operating Sytem]] is or what is an [[Ethernet]] connection.

Basically, building a dictionary within the vault, that can even link to full exhaustive .md documents if the readers want to go deeper.

and again, thanks for this amazing tool.

Folders doesn’t expand

Describe the bug
I tried Perlite on my local machine, move my vault to root, add perlite code there and it opens, Viola, it’s magic!! :slight_smile:

However, folders doesn’t expand, when I click on folder, I got this error in browser console:

Uncaught DOMException: Document.querySelector: '#1.-Projects-collapse' is not a valid selector
    i index.js:64
    <anonymous> collapse.js:318
    n event-handler.js:119

To Reproduce
Steps to reproduce the behavior:

  1. Downloaded PAAN Starter Kit from: https://forum.obsidian.md/t/paan-starter-kit/21782
  2. Expanded into my apache root folder (I tried also with nginx), named the folder as paan
  3. Added Perlite code there in same folder
  4. Opened browser to http://localhost:8080/paan
  5. Site is working for files outside folders but folders doesn't expand

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: chrome and firefox

Support Graph view when working with multiple Vaults

Describe the bug
If I try creating a site that hosts multiple vaults, then the Graph views do not work.

To Reproduce
Steps to reproduce the behavior:

  1. Do not define a NOTES_PATH variable.
  2. Have the Demo directory inside the perlite directory
  3. Have multiple other vaults inside the perlite directory

Expected behavior
Graph views for each individual vault when navigating into it.

Desktop (please complete the following information):

  • OS: Ubuntu 22/04 LTS
  • Browser Chrome
  • Version 103

Additional context
I even tried moving the metadata.json file to the root perlite directory when setting up the Demo site. In this case, the Graph only shows the README file. The only time the Graph seems to show is if the Perlite instance is set up to serve only one vault.

support footnotes

Footnotes are some "extra" Markdown feature, to support this with the current parser (I`m using parsedown), I would need to add parsedown-extra

unfortunately there is an issue with footnotes and enabled safeMode: erusev/parsedown-extra#158

image

without the safeMode it is working fine
image

However, at the moment I wont implement this at the cost of losing safeMode, so I need to wait for a fix in parsedown-extra or need to look for a different markedown parser.

Images reference breaks Obsidian to Google drive To dataset to perlite

Obsidian Vault is mapped to a google drive.
Cloud sync periodically pulls data off the cloud to a Truenas dataset
Data set is shared to perlite server with NFS share

Tested with document pwndbg.md (from demo folder):
Copied whole folder Dynamic Analyses to the Google drive

Images are rendered to Perlite.
MD referenced are mapped to (for example)

![[docs/Pasted image 20211031200413.png]] in the original MD file

IF Obsidian touches the document, is changes the image reference to:
![[Pasted image 20211031200413.png]]

Then it breaks on perlite
image

I tried adding the /docs/ before the image name like in the original file:
Images reference breaks in obsidian but works on perlite.

I the tried ./docs/ And it Works...

Is there a special trick to make this work more fluently? Plugin that should be used? From my perspective, my Obsidian version does not work as indended with image references.

Thanks

File links does not work properly

Describe the bug
links does not work properly for files, they are behaves like normal md links, not file links

To Reproduce
Steps to reproduce the behavior:
Link a file like: [[book.pdf]] does not work
Link a file like: [[book.pdf| Book Volume 1]] does not work
Link a file like: ![[book.pdf| Book Volume 1]] does not work

Expected behavior
3 of them needed to behave like: ![[book.df]]
[Book Volume](book.pdf) does work perfectly

Desktop (please complete the following information):

  • OS: Linux
  • Browser Firefox
  • Version 108.0.2

docker-compose deploying Perlite can not access the site problem

I tried to run docker-compose.yml with Docker-Compose, but the Perlite-web site is still inaccessible.So how to fix this problem?

My steps

  1. Copy Perlite repository to /home/perlite.
  2. Modify the port of docker-compose.yml. 80=>8888.
  3. Run docker-compose up -d

Version

  • Docker Compose version v2.14.1
  • Docker version 20.10.22, build 3a2c30b

Logs

perlite_web:stable

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2023/01/10 06:57:30 [warn] 1#1: conflicting server name "localhost" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
2023/01/10 06:57:30 [notice] 1#1: using the "epoll" event method
2023/01/10 06:57:30 [notice] 1#1: nginx/1.22.1
2023/01/10 06:57:30 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
2023/01/10 06:57:30 [notice] 1#1: OS: Linux 5.16.0-0.bpo.4-amd64
2023/01/10 06:57:30 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2023/01/10 06:57:30 [notice] 1#1: start worker processes
2023/01/10 06:57:30 [notice] 1#1: start worker process 28
2023/01/10 06:57:30 [notice] 1#1: start worker process 29
2023/01/10 06:57:30 [notice] 1#1: start worker process 30
2023/01/10 06:57:30 [notice] 1#1: start worker process 31

perlite

[10-Jan-2023 06:57:29] NOTICE: fpm is running, pid 1
[10-Jan-2023 06:57:29] NOTICE: ready to handle connections

Wildcard for exclusion

Is it possible to hide files and folders containing a particular character in the Compose file.
(or anywhere else)

I tried - HIDE_FOLDERS=docs,private,trash,-*
for example, of course it didn't work.

The aim of doing this is being able to hide folders off the Perlite View, while still making the files freely available in Obsidian.

function isValidFolder($file)
{

global $hideFolders;
$folderName = mb_basename($file);

// check if folder is in array
if (in_array($folderName, $hideFolders, true)) {
	return false;
}

**if (strcmp(substr($folderName, 0, 1), '.') !== 0) {**
	return true;
}

return false;

}

I expect I could add somthing around that '.' in there, but I really don't know what i'm doing!

Thanks for your help

The Docker version cannot start on aarch64 architecture

Describe the bug
The log says

exec /usr/local/bin/docker-php-entrypoint: exec format error

To Reproduce
Steps to reproduce the behavior:

docker compose up

Without changing any configurations

Desktop (please complete the following information):

  • OS: Debian GNU/Linux 11 (bullseye) aarch64
  • Host: Raspberry Pi 4 Model B Rev 1.1

Support renaming links

In Obsidian, there is an option to rename internal links:

[[Linked file|New name]]

The delimiter is the | symbol.

I can implement the feature myself, you just need to tell me, where in the source code you parse links.

Thank you

Support image resizing

Is your feature request related to a problem? Please describe.

Obsidian established the following syntax to rescale images:
![[og-image.png|200]]
This currently breaks the image links in Perlite.

Describe the solution you'd like

It would be great if Perlite could support scaled images the way Obsidian does.

Describe alternatives you've considered

Scaling the images outside of obsidian is valid, but kind of a hassle.

Font Size Slider Not Behaving as Expected

Describe the bug
Branch 1.5_beta

When changing the font size using the slider, the following behaviours happen:

  • The starting position does not reflect the current or defaukt font size, but instead is exactly half way of the slider length.
  • Moving the slider to the half way point (i.e. the default starting point) does not reset the font to the default size, but is instead a larger size.
  • Clicking the reset font size button does not move the slider back to the default position.

To Reproduce
Steps to reproduce the behavior:

  1. Clean install of Perlite
  2. Changing the font size in either the global Settings panel or the individual page settings

Expected behavior

  • Font slider starting position would reflect current font size
  • Moving the slider back to the default position should reset to the default font size

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Browser Chrome
  • Version 106.0.5249.119 (Official Build) (64-bit)

Smartphone (please complete the following information):

  • Device: iPhone11 Pro Max
  • OS: iOS 16
  • Browser Safari

Additional context
Discussed on Discord

Responsiveness of Sidebars Not Working Properly When Enlarging Window

Describe the bug
When the browser window width <= 990 px, the responsive layout hides the right-hand sidebar and makes the left hand sidebar collapsible, minimising it to a menu button when a page is opened. When the left hand sidebar has been collapsed and the browser then scales up above the 990 px breakpoint, then the menu button is hidden but the menu itself is not shown.

Furthermore, when the menu is expanded, it squeezes the main content panel. It would look a lot better if the main content panel was hidden when the menu was toggled open.

Also, if the browser width is <= ca 1050 px, the right hand sidebar overlaps over the button to minimise the sidebar, making it impossible to close that sidebar and focus on the main content. Perhaps it would be useful to set a minimum width for the main content panel so that it does not get squeezed by the sidebars in a way that prevents the buttons from being operable?

To Reproduce
Steps to reproduce the behavior:

  1. View a page on a browser with width less than 990 px
  2. Open a page so that the page content is visible but the menu is collapsed
  3. Scale the browser width above 990 px

Expected behavior
The menu button should be hidden when the browser width is > 990px, but the menu should also be shown.
The main content panel should have a minimum width so that the buttons to hide the right hand sidebar do not get covered by the sidebar.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Browser Chrome

Smartphone (please complete the following information):

  • Device: [e.g. iPad Pro 11" 2021]
  • OS: iOS 15.5
  • Browser Safari

Additional Context
Screenshots in Discord

Remove the double links in the graph

The ability to remove double links when they are bidirectional links in the graph.
Seen on Discord. It would be necessary to implement a control before the creation of the graph.

Thanks in advance :)

image

Password protect access

Hi, don't know if this is the right place to ask as I guess it's a webserver running thing more than a perlite issue, but is it somehow possible to restrict access to the web viewer? I want to run a team wiki, but not have this publicly accessable through the web. So some kind of login/ access control would be great.

Sadly my understanding of "server stuff" is quite limited. And while it is madness, i do have a dedicated server and a hosted one to be used for this (would prefer the hosted option though)

Thanks for any help or hint to the right ressources, cheers

Layout messed up on smaller resolutions

If there are many md files in the root directory and you use a resolution like 1366x768 or smaller, the layout breaks if you visit a file via direct link, that is not visible in the sidebar on the first page load.

image

The error seems to be related to the sidebar size, there is a scrollbar but on smaller (non mobile) resolutions, the last menu entries are missing.

Thanks to @Tooa for the reporting

Multiple Blockquotes separated by a newline being grouped in single blockquote

Describe the bug

Parsedown does not identify different blockquotes when the blockquotes are just separated by a newline. The following markdown file:

> This is a blockquote

> This is another blockquote

results in the following HTML

<blockquote>
<p>This is a blockquote</p>
<p>This is another blockquote</p>
<blockquote>

Note that this is an upstream issue.

To Reproduce
Steps to reproduce the behavior:

  • Go to the Parsedown Demo
  • Enter the markdown file listed in the issue description

Expected behavior

<blockquote>
<p>This is a blockquote</p>
</blockquote>
<blockquote>
<p>This is another blockquote</p>
</blockquote>

Workaround

  • Add a newline and regular text between the elements

Screenshots

image

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Browser Firefox 102

Solution proposal

I tested the newest Parsedown beta v2.0.0-beta-1 and it looks like the problem is fixed in this version.

We may consider switching to this beta release and test how stable it works with our existing test documents. When upgrading to the latest version, I suggest to use Php Composer as well for managing the dependency.

Here is a step by step guide, how I tested the behavior with the beta release:

Setup

$ sudo apt install php8.1
$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
$ php composer-setup.php
$ php -r "unlink('composer-setup.php');"
# Dependencies
$ sudo apt-get install php8.1-mbstring
$ php ../composer.phar require erusev/parsedown:v2.0.0-beta-1
$ php demo.php

demo.php

<?php

require __DIR__ . '/vendor/autoload.php';

use Erusev\Parsedown\Configurables\Breaks;
use Erusev\Parsedown\Configurables\SafeMode;
use Erusev\Parsedown\Configurables\StrictMode;
use Erusev\Parsedown\State;
use Erusev\Parsedown\Parsedown;


$markdown = <<<EOD
> This is a blockquote

> this is another blockquote
EOD;


$state = new State([
    new Breaks(true),
    new SafeMode(true),
    new StrictMode(false)
]);

$Parsedown = new Parsedown($state);
echo $Parsedown->toHtml($markdown);
?>

image

Links not rendered correctly

Image versions:

REPOSITORY                     TAG          IMAGE ID       CREATED         SIZE
perlite_web                    latest       9ce1a0f8db97   4 minutes ago   133MB
perlite_perlite                latest       e280f9861c9d   5 minutes ago   469MB

ObsidianFile.md:

- [[Staph. aureus]]
- [[Pseudomonas aeruginosa]]
- [[Stenotrophomonas maltophilia]]
- [[Burkholderia cepacia complex]]
- [[Achromobacter xylosoxidans]]
- [[Non-Tuberculous Mycobacteria (NTM)]]
- [[Fungal pathogens]]

Rendered as:
Cursor_and______Perlite_____

Am I doing something wrong?

Thanks

Nick

attachments are loaded if in the root folder, otherwise ignored

attachments are loaded if in the root folder, otherwise ignored

Screenshot 2023-02-18 at 12 42 11 PM

Screenshot 2023-02-18 at 12 41 53 PM

Screenshot 2023-02-18 at 12 42 26 PM

I copied one file to the root and added a link to it the .md file, it worked but the relative one didn't

Screenshot 2023-02-18 at 12 45 37 PM

again, there is a workaround, scripting files to move files from files inside to the root folder and and updating links

Checkboxes in tables with <input type='checkbox' />

I am using this for DnD and need checkmarks in a table. i found this sort of stupid way by using html and now thats how i do it everywhere.
These checkmarks don't get rendered properly and just get displayed as text which is not correct.

I dont know how i would fix this since in obsidian you cannot use simple [ ] and [ x ] syntax

I have some problems with footnotes and graph

  1. First, I noticed that the footnotes in the text didn't show up properly, but rather as normal text and couldn't jump hyperlinks.
    image
    image

  2. Secondly, my graph moudle has not been able to load, but I have not found any difference compared to the code.
    But what I noticed is that unlike your demo web page, the "Open-graph" button flashed for a moment and then disappeared.
    Not just my folder, but also the demo folder.
    image
    image

nginx 1.21.0
PHP 7.4.0

add border to tables

the border and border color is missing at the moment, I need to adjust the css for tables.

image

hide commented out blocks

commented out (I keep it hide yaml from note metadata but for stuff like navigation, clean up) doesn't work on perlite

Screenshot 2023-02-18 at 11 55 15 AM

Describe the solution you'd like

It should like obsidian

Screenshot 2023-02-18 at 12 01 15 PM

Screenshot 2023-02-18 at 12 01 21 PM

The symbol ( & ) in note names is replaced by ( &amp ) which breaks the graph links

Describe the bug

I use special characters in the name of notes in my knowledge base to determine the type of note.
At least, symbol ( & ) in note names is replaced by ( &amp ) on graph panel, with breaks the graph links, an lead to unexistent note.
When you go to such a note from the left panel, the graph is not updated, and when you go from the graph to such a note, a blank page opens.

Probably other special characters allowed in Windows for use in file names also lead to a similar error.

To Reproduce

  • Create note, with name beginning wit "&"
  • Try open note from graf view
  • Try open note from left tree panel

Expected behavior
The symbol ( & ) and other windows allowed symbols in note names is not changed in view.

Screenshots
My test few notes in graf (multiple node connections also look weird)
image

image

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Google Chrom
  • Version Latest perlite 1.5.1

Docker hub

Is your feature request related to a problem? Please describe.
Not available without building it yourself, it would simplify the deployment without this extra-step!

Describe the solution you'd like
Being available without the need of building it.

Describe alternatives you've considered
Docker Hub and the github packages "ghcr.io" are available for free.

Mermaid subroutine shapes are broken

Mermaid node in a subroutine shape can´t be rendered at the moment, because they share the same pattern as internal Obsidian links and these getting replaced in the php engine to provide web functionality.

At the moment I cant see a regex to only replace internal links and not also mermaid subroutine shapes.

Idea so far: replace links via JS in mermaid css class objects after rendering, but this means that also "normal" links in any mermaid block will be broken.

first line break not considered

I just noticed that in a note, the first line break is not converted to an html line break.
For example, in my headers, on obsidian I have one line per field, and on perlite everything is on the same line.

image
image

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.