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

Fix image upload and resolver and use CommonMark #69

Open
wants to merge 16 commits into
base: dev
Choose a base branch
from

Conversation

AlbanCrepel
Copy link
Contributor

Closes #65

@AlbanCrepel AlbanCrepel requested a review from decima July 22, 2020 06:56
@AlbanCrepel AlbanCrepel added the enhancement New feature or request label Jul 22, 2020
@AlbanCrepel AlbanCrepel added this to the KIP - 1.0 milestone Jul 22, 2020
$pureTitle = strip_tags($render);

if ($block instanceof Heading) {
$this->headers[] = ["text" => $pureTitle, "level" => $level = $block->getLevel(), "id" => $id = "h$level-" . $this->slugify($pureTitle) . "-" . substr(md5($render), 0, 10)];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, indenting theses long multi parameters string in vertical to be more readable.

["text" => $pureTitle,
 "level" => $level = $block->getLevel(),
...,
]




public function extractTOC()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking this function into multiple chunks will help maintaining and understanding the code later

if (count($lastOfLevel) < 1) {
$tree[] = &$c;
}
$lastOfLevel[$c["level"]] = &$c;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid abbreviating variable please :/


}

private function slugify($string, $delimiter = '-')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick comment to summarize what will be cleaned after this function. Or a link to a standard "slugify" process explanation

return ["!"];
}

public function parse(InlineParserContext $inlineContext): bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Break this function into small reusable chunks will help maintaining the code.
Also a quick comment to explain whats happening here

throw new \InvalidArgumentException('Incompatible inline type: ' . get_class($inline));
}
dump($inline);
$style = implode("", array_map(fn($k, $v) => "$k: {$v}px;", array_keys($inline->getData("size", [])), array_values($inline->getData("size", []))));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiline syntax for parameters help readability here.


use Symfony\Component\Finder\SplFileInfo;

class File
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purpose of this POPO as comment can help

public SerializerInterface $serializer;


public function parse(MarkdownFile &$file)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why parsing Markdown is done with PHP and not by the front-end ?

decima and others added 7 commits October 2, 2020 16:27
* adding trusted_proxies for dev and public opened to everyone by default

* Revert "adding trusted_proxies for dev and public opened to everyone by default"

This reverts commit 48776e9.

* adding permission + fix upload/edit file

* adding readonly info

* update for passing through twig constants

* fix: move settings to plugins

* quick fix typo in delete

* fix: removing route for settings
* adding trusted_proxies for dev and public opened to everyone by default

* Revert "adding trusted_proxies for dev and public opened to everyone by default"

This reverts commit 48776e9.

* fix: setting default to fileName

* fix: quick fix for a not existing file
* adding trusted_proxies for dev and public opened to everyone by default

* Revert "adding trusted_proxies for dev and public opened to everyone by default"

This reverts commit 48776e9.

* adding meta title to page - needs more styling I think

* fix: style test

* move article title and make it optionnal

* removing computed for current metadata

* fix: removing extra useless component
* Revert "adding trusted_proxies for dev and public opened to everyone by default"

This reverts commit 48776e9.

* adding meta title to page - needs more styling I think

* fix: style test

* move article title and make it optionnal

* removing computed for current metadata

* fix: removing extra useless component

* adding custom header metadata handler

* rebasing

* removing unwanted changes

* fix: removing useless changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change parseDown to thephpleague\commonmark
3 participants