Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

Replace parsedown with commonmark #288

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions app/views/docs/environment-variables.phtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php
$variables = $this->getParam('variables', []);

$markdown = new \Parsedown();
$markdown->setSafeMode(true);
$variables = $this->getParam('variables', []);
$markdown = $this->getParam('markdown', false);
?>

<p>Appwrite environment variables allow you to edit your server setup configuration and customize it. You can easily change the environment variables by changing them when running Appwrite using Docker CLI or Docker Compose.</p>
Expand Down Expand Up @@ -34,7 +33,7 @@ $markdown->setSafeMode(true);
<h2 id="<?php echo $this->escape(strtolower(str_replace(' ', '_', $category))); ?>"><a href="/docs/environment-variables#<?php echo $this->escape(strtolower(str_replace(' ', '_', $category))); ?>"><?php echo $this->escape($category); ?></a></h2>

<?php if($description): ?>
<p><?php echo $markdown->text($this->escape($description)); ?></p>
<p><?php echo $markdown->convert($this->escape($description)); ?></p>
<?php endif; ?>

<table cellspacing="0" cellpadding="0" border="0" class="full margin-bottom-large">
Expand All @@ -58,7 +57,7 @@ $markdown->setSafeMode(true);
<p class="margin-top-small text-fade">version >= <?php echo $this->escape($introduction); ?></p>
<?php endif; ?>
</td>
<td><?php echo $markdown->text($this->escape($description)); ?></td>
<td><?php echo $markdown->convert($this->escape($description)); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
Expand Down
6 changes: 2 additions & 4 deletions app/views/docs/models.phtml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?php
$models = $this->getParam('models', []);
$model = $this->getParam('model', null);
$markdown = $this->getParam('markdown', false);
$rules = $model['properties'] ?? [];

$markdown = new \Parsedown();
$markdown->setSafeMode(true);

$example = function ($model, $models) use (&$example)
{
$output = [];
Expand Down Expand Up @@ -126,7 +124,7 @@ $example = function ($model, $models) use (&$example)
<?php endif; ?>
<?php endif; ?>
</td>
<td data-title="<?php echo (!empty($description)) ? 'Description: ' : ''; ?>"><?php echo $markdown->text($description); ?></td>
<td data-title="<?php echo (!empty($description)) ? 'Description: ' : ''; ?>"><?php echo $markdown->convert($description); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
Expand Down
5 changes: 2 additions & 3 deletions app/views/docs/sdks.phtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

$platforms = $this->getParam('platforms', []);
$markdown = new \Parsedown();
$markdown->setSafeMode(true);
$markdown = $this->getParam('markdown', false);

?>

Expand All @@ -23,7 +22,7 @@ $markdown->setSafeMode(true);
<?php if(!$platform['enabled']) { continue; } ?>
<h2 href="/docs/sdks#<?php echo strtolower($platform['name']); ?>" id="<?php echo strtolower($platform['name']); ?>"><?php echo $platform['name']; ?> SDKs<?php if($platform['beta']): ?> (beta)<?php endif; ?></h2>

<p><?php echo $markdown->text($platform['description']); ?></p>
<p><?php echo $markdown->convert($platform['description']); ?></p>

<table cellspacing="0" cellpadding="0" border="0" class="full margin-bottom-large text-size-small vertical">
<thead>
Expand Down
10 changes: 4 additions & 6 deletions app/views/docs/service.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $service = $this->getParam('service', []);
$blacklist = $this->getParam('blacklist', []);
$description = $this->getParam('description', '');
$spec = $this->getParam('spec', []);
$markdown = $this->getParam('markdown', false);
$host = (isset($spec['host'])) ? $spec['host'] : '';
$base = (isset($spec['basePath'])) ? $spec['basePath'] : '';
$endpoint = $this->getParam('protocol', 'https') . '://' . $host . $base;
Expand Down Expand Up @@ -32,9 +33,6 @@ $codes = [
],
];

$markdown = new \Parsedown();
$markdown->setSafeMode(true);

$paramSDK = (!empty($sdk)) ? '?sdk='.$sdk : '';
?>

Expand Down Expand Up @@ -198,7 +196,7 @@ $paramSDK = (!empty($sdk)) ? '?sdk='.$sdk : '';
<div class="col span-8 margin-bottom">

<div class="content margin-end-xl">
<?php echo $markdown->text(file_get_contents($path)); ?>
<?php echo $markdown->convert(file_get_contents($path)); ?>

<div class="clear">
<a href="https://github.com/appwrite/appwrite/edit/master<?php echo $description; ?>" class="pull-end text-size-small" target="_blank">Edit on GitHub <i class="icon-github-circled"></i></a>
Expand Down Expand Up @@ -302,7 +300,7 @@ $paramSDK = (!empty($sdk)) ? '?sdk='.$sdk : '';
</div>

<?php if(!empty($description)): ?>
<?php echo $markdown->text($description); ?>
<?php echo $markdown->convert($description); ?>
<?php endif; ?>

<div class="clear">
Expand Down Expand Up @@ -408,7 +406,7 @@ $paramSDK = (!empty($sdk)) ? '?sdk='.$sdk : '';
<?php endif; ?>
</td>
<td data-title="Type: "><?php echo $this->escape($type); ?></td>
<td data-title="<?php echo (!empty($description)) ? 'Description: ' : ''; ?>"><?php echo $markdown->text($description); ?></td>
<td data-title="<?php echo (!empty($description)) ? 'Description: ' : ''; ?>"><?php echo $markdown->convert($description); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"ext-imagick": "*",
"ext-mbstring": "*",
"ext-json": "*",
"erusev/parsedown": "1.7.4",
"utopia-php/framework": "0.*.*"
},
"require-dev": {
Expand Down
Loading