nilsnolde / wordpress-markdown-git

:loop: WordPress plugin to add file content (Markdown, Jupyter notebooks) from a Git based VCS to a WordPress post; replaces https://github.com/gis-ops/md-github-wordpress
GNU General Public License v3.0
48 stars 14 forks source link

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

Open OskarSwierad opened 3 years ago

OskarSwierad commented 3 years ago

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 commented 3 years ago

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: https://github.com/gis-ops/wordpress-markdown-git/blob/eb8074c6fbe5a4ce7da05720a66458a1806d8e0f/documents-git/includes/providers/class-base-loader.php#L147-L172

danilopinotti commented 3 years ago

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]