mkdocs expandable content loads separate md document - expandable

Is it possible to have an expanded section of a doc load the contents of another md document? The expandable content could be used in other documents, so instead of getting into version hell, I'd like to create one md doc that I can reference. Right now I have links to the doc with the shared content, but it would be nice to have it load as expandable content instead of loading another page.
<details>
<summary>Click to expand!</summary>
Here it would load the contents of another md document.
</details>

Related

Displaying New tab after clicking a tag

I am new to Hugo and I want to quickly make a portfolio to display my Google Drive Excel sheet, so I downloaded a theme. Here's a template that generates Markdown that I have been trying to edit:
<p>{{. | markdownify}}</p>
I want clicks on links generated by markdownify (in that p tag) to open in a new tab.
You can adjust the global Markdown rendering settings to make links in Markdown always open in a new tab by using the Blackfriday Markdown renderer and setting the hrefTargetBlank flag. Add this to your config.toml (or the equivalent in YAML/JSON)
[markup]
defaultMarkdownHandler = 'blackFriday'
[blackFriday]
hrefTargetBlank = true
If you need more complicated logic to determine when to make links open in a new tab or need to use the Goldmark Markdown renderer, you can use the render-link render hook to override the output of the Markdown renderer with a template. The simplest render hook to do this would be this (in layouts/_default/_markup/render-link.html). See the documentation for the full details on this.
{{ .Text | safeHTML }}

Instantiate Prawn PDF Document from document render

I'm using PrawnPDF to create a PDF file and then using CombinePDF to append other files and render out the PDF for download. But I need to add anchors from the table content to the files that are appended afterwards so I want to be able to re-instantiate a Prawn::Document from the final rendered content, is there any way to do this? Or maybe someone can guide me to a better solution than the one I have in mind?

Generate Text (.txt) file for Data displayed in GSP

I have a Grails app developed in 2.3.6
There's a GSP file with HTML and CSS elements in it, and that displays data in multiple tables with headers.
I want this data to be saved into a text file and save it. So basically what i want to do is, there will be a Export button in this GSP page, and when user clicks on it, it will download the text file with all the data from that GSP.
What i tried so far?
def textFile = {
response.setHeader('Content-Disposition', 'Attachment;Filename="textFile.txt"')
render view: 'textFile', contentType: 'text/plain'
}
The problem with above is, it saves not just data, but also HTML & CSS elements.
I don't want any HTML or CSS in the text file. Only data from GSP is needed.
Is there a simple way of doing it.
the answer is simple - you need another view withouth the html and css parts.
The rest of your code looks good. But Grails itself does not convert your view, it just sends the content type to the browser and the browser tries to diesplay the data according to the content type.
If you don't want to write a new view (in most cases, writing the new view is dead simple), you could write your own converter (something which strips the HTML and CSS from your file) by creating an afterView-Filter: http://grails.github.io/grails-doc/2.4.0/guide/single.html#filters
Hope that helps

Use a html page as a custom section in Umbraco 7 without a tree

I have a HTML page that I want to show in a custom section in Umbraco 7.
I want to do this without having any tree within that section, as everything is already handled within the html file - It is being placed into the Umbraco back end for convenient access.
So far I have implemented IApplication which gets the section to show as expected. I did have a tree with a single node (Inheriting from BaseTree, making this a legacy section), however, I want to make full use of the space available and just load in my html file and have no tree showing.
Removing the nodes from the BaseTree Render method hides the panel that shows the tree, but I can't figure out how to load in the Html file as the default view for that section.
Is there an easy way to do this by essentially setting a default page to load when the user clicks into the section?
You can set the default view for a custom section in Umbraco 7 by adding a new section element to Dashboard.config as follows:
<section alias="StartupCustomDashboardSection">
<areas>
<area>custom</area>
</areas>
<tab caption="Get Started">
<control>/app_plugins/custom/defaultview.html</control>
</tab>
</section>
where the <area> element must contain the alias of your custom section, all in lower case.
The <control> element contains the path of the default html file.

Generate a dynamic table of contents based on (already) rendered headings with Rails

Many Wikis have it, a table of contents based on the headings from the displayed page. I'm looking for an easy possibility to realize that with Rails.
I have different kinds of pages, like dynamically generated ones, processed markdown pages as well as static pages. All these pages have HTML headings on different levels. How can I generate a Wiki like table of contents, which links to the headings with anchors?
I already searched for a post render callback or another entry point in the life cycle, which is happening after rendering, but I didn't found really one. What would you suggest to do? .. implementing a middle ware or what would be your direction?
If you decide to stick with markdown for all your content, you can do this with the Redcarpet gem. Passing with_toc_data: true to the renderer will add anchors to header tags. And re-rendering with Redcarpet::Render::HTML_TOC will generate a list of links linking to those header tags.

Resources