I have been using github pages with jekyll for auto-generating my blog using markdown documents.
I would like to use reference-style links then show a list of the links at the bottom of the page.
basically, I want the reference-style links to be printed on the page, by default they are hidden.
The idea is to have a list of references that a reader can refer to for more information.
for example, the following text:
# some header
...some body text in the blog with a link to [wikipedia][1]
...
...
# reference links
[1]: https://www.wikipedia.org
should generate the following output:
some header
...some body text in the blog with a link to wikipedia
...
...
reference links
[1]: https://www.wikipedia.org
As seen, the reference-style link is used in the markdown but it is also displayed on the page.
The previous "correct" output was achieved by duplicating each line and escaping the special characters, but this seems a bit redundant.
Can this be achieved by changes to _config.yml or using ruby? Other options are also welcome (css magic?).
tldr; I want a way to "unhide" the reference-style links at the bottom of my markdown page.
First, you have to understand exactly what is doing what:
Your markdown parser is converting your markdown into html.
Jekyll is taking that html and organizing it into pages.
GitHub pages is serving up those html pages.
The client reads that html and executes any JavaScript, etc.
The problem is that the markdown parser doesn't include the reference links at the bottom of the page. It's not like they're there but hidden. They simply aren't there. So you aren't going to find a CSS solution, because there isn't anything to style. You might be able to accomplish this with a custom markdown parser that includes the reference links in the generated html, but that won't work with GitHub pages and is probably going to be pretty hackish.
Another option is to execute JavaScript that uses document.links to get every link on the page, then output them in a <ul> or something at the bottom of the page. Something like this:
var links = document.links;
for(var i = 0; i < links.length; i++) {
var linkHref = document.createTextNode(links[i].href);
var lineBreak = document.createElement("br");
document.body.appendChild(linkHref);
document.body.appendChild(lineBreak);
}
You might restrict that to only include links in a certain div (like this), that way you don't have to parse out your navigation links and whatnot. You also have to consider the order.
Another option might be to include them in each post's frontmatter as a yml list, then show those in the layout that displays the post.
Of course, you could also simply create the reference yourself using markdown.
Related
I created a new table as a content element and I want to include my css file, but I can't find an option. Recently I found a youtube video with an "Additional css" option, but I don't have this one, unfortunately.
I have already included my css file to fileadmin/ under Filelist. I do not know how to proceed.
Here are the related Docs: https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Setup/Page/Index.html#includecss-array
Search for page = PAGE in your project and add the includeCSS lines:
page = PAGE
page {
# ... many things
# ... Add the following
includeCSS {
file1 = fileadmin/yourCssFile.css
}
}
This should fix your problem, but putting the CSS into your fileadmin/ is not best practice.
I recommend you to read the Site Package Tutorial: https://docs.typo3.org/m/typo3/tutorial-sitepackage/master/en-us/
You can have a look at the Site Package Builder and see how it is done there: https://sitepackagebuilder.com/
You can ask further questions here in stack overflow or sign up in Slack: https://typo3.slack.com/
Wish you fun!
I would like to create a wiki page that is a preamble (standard markdown) followed by an HTML/JS code listing followed by (in a frame I suppose) the page that this code would generate.
Is this possible?
PS The code is: http://pipad.org/MathBox/slides_simple.html
Github Wikis allow you to embed HTML, but not all HTML tags are supported.
To embed supported HTML:
Edit a wiki page.
Ensure the edit mode is on "Markdown".
Type the html directly into the main content area (there's no "code" view, like you often see in tools like Wordpress).
Which tags aren't supported?
I couldn't find documentation on this, but we have a few clues:
Github wikis are built on a software tool called Gollum. We can see which tags are supported in Gollum by default here in the Gollum docs. Github may customize these defaults for their use-case, but I'll bet it's pretty similar.
I went ahead and created a test wiki here with all the major visual html elements added to it (copied from Poor Man's Styleguide). It looks like the main tags that don't display are iframe, video, audio, and all of the various form inputs (textarea, input, select, etc).
Is there a way to open the below markdown link in new tab? I've got some result from markdown target=“_blank”, but in my case it's different have used <> symbol to projected the link.
http://google.com
Not used the usual format
(name)[linkname]
Used
<>
Inside this projected the link name. Is possible to open this link in new tab?
The kramdown syntax:
[link name](url_link){:target="_blank"}
can be parsed into HTML using the kramdown online editor:
https://kramdown.herokuapp.com/
Then you can paste the HTML syntax into your markdown document.
I used it because I already had quite a few kramdown references, and wanted to avoid retyping them in HTML.
Doing some quick research - Markdown by default does not support this. Some solutions include using plugins like Kramdown, but I think the best solution is just to use an HTML tag in your markdown file. (as pointed out in the comment above ^)
# Some markdown
*click below*
New Tab
...
As far as I could find, this is not possible on GitHub currently. See good answer on this from Plaul here. I hope they will fix it soon, as it seems searching for an answer that this is something a lot of people would like to see.
If you have access to JavaScript, you can run a simple script to handle this for you wherever your markdown is rendered:
const anchors = document.querySelectorAll('a');
anchors.forEach((a) => {
a.setAttribute('target', '__blank');
a.setAttribute('rel', 'noopener noreferrer');
});
I am having an issue with the SEO plugin from Yoast. By default, the Yoast plugin for Wordpress creates multiple og:image tags on my site. But I have no idea how to remove the other ones that are being generated by the plugin...
So how do i force it to only use the one I defined in the social section of the plugins settings area?
Best Regards
Webzunft's answer worked okay for me in removing the extra images but it broke the Keyword Density and other counts in Page Analysis tab. I solved it by stripping img tags from the content instead of returning an empty string:
function mysite_opengraph_content($val) {
return preg_replace("/<img[^>]+\>/i", "", $val);
}
add_filter('wpseo_pre_analysis_post_content', 'mysite_opengraph_content');
This way the plugin sees the text with no images and counts keywords correctly.
WordPress SEO creates the Open Graph tags for images for the featured image, all the images from the post content and if not any of those, uses the default image you specified in the settings area.
In my case, I wanted to switch off the use of the images in the content and only create the Open Graph tag for the featured image. This is easy added the following filter in your theme’s functions.php:
add_filter('wpseo_pre_analysis_post_content', 'mysite_opengraph_content');
function mysite_opengraph_content($val) {
return '';
}
This clears the content that is searched for images.
I explained the 3 filters one might use to manipulate how WordPress SEO created the Open Graph for images in this article: http://webgilde.com/en/wordpress-seo-facebook-image-open-graph/
UPDATE: as JoseV pointed out, my function has a drawback. The filter is also used when analyzing the content for SEO. JoseV posted a solution that prevents some of the analysis functionalities.
Is there a way in github to have a wiki's title be based on the markup? I have found another project using markdown that has the title for Home.md wiki page come from the file. The author could have also used the web interface and made the title of the page the same as the markdown. That project is here:
https://github.com/sitaramc/gitolite/wiki
When I tried doing the same thing with restructuredtext (Home.rest) using the underline of ='s the title ends up being ignored and not even shown in the rendered page. The same thing also happens when using markdown.
Looking at this pull request from a few months ago and the related discussion, it appears that the page title used to be set based on the markdown, but is now based exclusively on the filename.
That would explain why a project might have RestructuredText/Markdown that appears to define the title (it once did!), but the same doesn't work for you.
It appears that you're out of luck for defining the wiki page title through the RestructuredText/MarkDown file these days.