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

[Feature request] Skip a given number of lines #27

Open
OskarSwierad opened this issue Apr 7, 2021 · 2 comments
Open

[Feature request] Skip a given number of lines #27

OskarSwierad opened this issue Apr 7, 2021 · 2 comments

Comments

@OskarSwierad
Copy link

OskarSwierad commented Apr 7, 2021

Hey! It'd be nice to have a possibility to skip a chosen number of lines at the beginning of the parsed Markdown. That's because GitHub README usually contains information that doesn't matter for the website where it's embedded. Cheers and thanks for a great plugin.

@nilsnolde
Copy link
Member

Good suggestion! I often get annoyed when there's a title twice, one from the WP post and the other one from markdown.. Never thought about this solution (or any for that matter..).

I'll include this in the next batch of improvements, though not sure when that's gonna happen unfortunately.. Happy to review if you wanna give it a shot: somewhere between getting the raw markdown and requesting the rendered markdown here:

list($raw_markdown, $response_code) = $this->get_document();
switch ($response_code) {
case 200:
break;
case 404:
$raw_markdown = "# 404 - Not found\nDocument not found.";
break;
case 401:
$raw_markdown = "# 401 - Bad credentials.\nPlease review access token for user " . $this->user;
break;
case 403:
$raw_markdown = "# 403 - Bad credentials.\nPlease review access token for user " . $this->user;
break;
default:
$raw_markdown = "# 500 - Server Error.\n$raw_markdown";
}
$args = array(
'body' => json_encode(array(
"text" => $raw_markdown
)),
'headers' => array(
'Content-Type' => 'application/json'
)
);

@danilopinotti
Copy link
Contributor

danilopinotti commented Apr 8, 2021

I liked this suggestion too.

@nilsnolde currently I use a workaround to avoid show the title twice:

/* My CSS */
.hidden-first-h1 h1:first-of-type {
  display: none;
}
// My post content

[git-add-css classes="hidden-first-h1"]
[git-github-markdown url="https://github.com/danilopinotti/blog-posts/blob/master/2021-03-13-explicando_operadores_bitwise.md?v=3"]
[/git-add-css]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants