I am setting my blog up using the fantastic Jekyll. Question is my markdown files are being shown in full on the homepage. How do i make them look more like this? So that only a little bit comes up with the title?
Thanks.
http://daverupert.com/
EDIT: As of Jekyll 1.0, this is not longer necessary (Answer is outdated).
Jekyll 1.0 exports a post.excerpt variable that contains the first paragraph of a post by default.
/Edit
So, you want to show an excerpt of the post, instead of the full post?
Theres three ways to do that:
Render the full post but use CSS to hide everything that is not needed
Use filters. You can access post.content, use the truncate filter to truncate it and the markdownify filter to render it.
Specify the excerpt in YAML Front Matter and render it using {{post.excerpt | markdownify}} (that is what i do on my blog)
Each of those blocks between horizontal lines are links to the actual blog post. Any time I have a question about how someone did something on their webpage I always view-source.
The source for that page is -
view-source:http://daverupert.com/
To find out how to do something in markdown I like this site -
http://daringfireball.net/projects/markdown/basics
Related
I am trying to write a jekyll plugin that will take a normal markdown file and provide some extra functionality on top of it. In particular, I need to do some (not actually) fancy things with tables. I know you can write straight HTML into a markdown file, but there is a requirement that the content folks don't want to / can't edit HTML.
As an extra wrench in the works, the mobile layout has a UX requirement that I essentially have to render the table as a group of divs as opposed to a table.
My initial thought was to pass the {{page.content}} variable to a ruby function extending Liquid::Tag. From there I was planning on parsing the markdown file and either:
1. If normal non-table markdown, use as normal
2. If table markdown, look for custom identifier in markdown, do what needs to be done (e.g. add class, etc)
If I do something like this:
def render(context)
content = Liquid::Template.parse(#markup).render context
end
It renders the context as a normal markdown file. However, I want to break up the context variable and work with the pieces before rendering. I've tried a few different approaches that I've gotten from the jekyll docs and Stack Overflow and gotten nowhere.
Does anyone have any experience with this? I am heading down the right path? For what it's worth, Ruby/Jekyll/Liquid is fairly new to me, so if you think I may have missed something fairly basic and obvious then please let me know.
A markdown table tool for editors !
markdownify your table in http://www.tablesgenerator.com/markdown_tables
paste the markdown result in http://prose.io/
done
I don't know other way to simplify editor's work on Jekyll, but I'll be very interested in earing from your project. Good luck.
I have used CKEditor for a few years without really understanding it. I now want to use it to display text which will include HTML, CSS, JavaScript and PHP example code. None of that needs to execute it is just to show the code to others.
Currently I used the textarea replace method to edit content and I need to carry on that way. When I add the content first time it is sanitised (mysqli_real_escape_string) and stored in a MySQL database correctly. It also then displays correctly with the CKEditor markup working as markup and the HTML/PHP showing as a code example. However, when I edit the content a second time the HTML examples become "real" HTML and are no longer visible as examples.
For example this:
<?php echo "hello"; ?>
<p>Hello</p>
is correctly (?) stored as:
<p><?php echo "me"; ?></p>
<p><p>Hello</p></p>
and displays on the page as shown in the first code snippet (which is what I want). When I then hit edit again the code examples vanish into the background as real HTML (part of the page). If I put the code examples in as code snippets (which I would rather not have to do because of the intended users) the result in the editor (second edit) looks like this:
<!--?php echo "me"; ?-->
Hello
I am sure i am missing a basic understanding of what is going on behind the scenes but can anyone explain how to allow users to type in text which includes HTML, CSS, JavaScript, PHP and MySQL code examples which must then appear as examples and not markup (and be editable as examples).
I have played with config.entities and config.protectedSource after some research but they do not seem to be relevant (or to work). Weirdly a couple of times it seemed to work fine and I thought I had cracked it but then stopped with no further changes to the config. That means I now have less idea what I am doing than when I started!
You don't mention which version you are using, but if it's relatively new (4.4+) you can use the Code Snippets plugin that was designed exactly for this. See the demo at http://ckeditor.com/demo#widgets. It might help with the encoding issues too. There's docs on it too.
Th help with the current encoding issue, it would help a LOT if you showed us how you output the data and load it into CKEditor. For example "When I then hit edit again" doesn't really describe anything without context. For example, do you use setData() with AJAX? Do you use an inline editor? Code examples would be the best.
I have a list of FAQ links on my home page in a static block in the footer. Each link however just opens up the FAQ page.
My code sample
What is Individually Quick Frozen?</li>
What I want is that when a user clicks a particular link in the list on the homepage footer under FAQs (as above), the user should be directly be taken to the answer of that question on the FAQ page i.e. the page should scroll down to where the questions is answered.
My Code sample
<p><strong><a id="1">What is Individually Quick Frozen?</a></strong></p>
But no joy! what am I doing wrong?
Make your link look like this:
What is Individually Quick Frozen?</li>
or better yet
What is Individually Quick Frozen?</li>
Note: For Cms pages urls use direct_url as a parameter for the {{store}} directive. It avoids having a / at the end of the URL. Useful if your pages end with .html. It's not your case but it may be useful in the future.
Now your code in the cms page should looks like this:
<p><strong><a id="_1">What is Individually Quick Frozen?</a></strong></p>
Avoid using numerical ids for elements. It's not standard
Worked perfectly, be sure to update
<a href="{{store url="faqs"}}#_1">
"faqs" to what ever page you want your tag to land on though.
This is what I'm currently using to "grab" my posts: https://gist.github.com/Greduan/5977871
And then I do a for loop .toJSON() etc.
How can I make this grab an excerpt of the post and not all of the content? Cause I can just use #content but that'll output the entire post.
How can I make it have for example an excerpt with something like 500 characters then "..." and then a "Continue reading..." link or something along these lines.
I was thinking maybe using something like this:
#content.slice(0,500)
Or something like that. Would that work?
Thanks for your help. :)
Take a look at the answers here: Show only partial blog post in Docpad, with "Read More" link - they all involve some work, but the top one would probably do what you want.
I want to make pdf by markdown: write makrdown and convert it in pdf.
Can I page marking by means of a markdown?
I understand as "a page marking" transition to new page, location of a line to page center across, text location in page center, etc.
Thanks.
I suspect that the best way to get about doing this is to do a Markdown-HTML-PDF convertion. Your markdown implementation should be able to generate HTML and then use something like wicked_pdf (ruby) or the underlying wkhtmltopdf to go from HTML to PDF. The wicked_pdf documentation outlines how to do page numbering with the help of some javascript. For page breaking you should be able to use CSS to keep things together and force page breaks. Check out page-break-inside and page-break-after for this. There is a discussion about it in the wkhtmltopdf manual.