Skip to content

@jmalarcon jmalarcon released this Apr 25, 2020 · 1 commit to master since this release

This release has a revamped Markdown file caching and it includes a folder tree caching dependency to be able to invalidate caching when there are changes inside folders with nested subfolders. This is very useful for posts stored in a folder structure instead of all of them in the same folder or for special files such as sitemaps (although in that case, maybe disabling the cache for the sitemap is a good idea, since they are not frequently requested).

It adds a new property called CachingTimeOut that allows to specify the timeout in seconds to force the cache invalidation for any MIIS handled file (.md or .mdh). It can be set on the Front Matter of any file or in web.config to affect many files at once. If the timeout conflicts with the timeout set internally by any Front Matter source (for files that are going to be published in the future) the minimum of both values is used. This can be useful for especial Front Matter sources that get information from sources that you can't control hen they're refreshed. So, instead of setting the cache timeout value from the FM Source, it can be more flexibly established from the file itself using this property.

MIISFilesEnumeratorFMS.dll bumped to v1.2.0

Assets 3

@jmalarcon jmalarcon released this Apr 22, 2020 · 6 commits to master since this release

  • Added support to retrieve default files with the FilesFromFolder and PaginatorFor Front-Matter sources.
    • Now you can include index and default pages in the results by using a 3rd parameter (true) in the FilesFromFolder and PaginatorFor Front-Matter sources.
    • For example: files: FilesFromFolder ~/ false true will get all the .md and .mdh files from the site, so that you can easily create a sitemap.xml with all the pages in the site, for example.
    • Notice that the former third parameter to sort the files by date ascendingly, has been removed. This is a small breaking change and if you need to sort the files in a different way just use the sort and reverse filters. Take into account that the sort filter allows to sort the files by any of their properties (name, url, url_no_ext...)
  • Automatically remove the name of the default files (index or default) from the URL properties of files. That way, for example /blog/index will automatically be: /blog/. Much nicer.
  • Bumped MIISFilesEnumeratorFMS.dll to 1.1.0 and MIIShandler.dll to 3.3.0
Assets 3

@jmalarcon jmalarcon released this Apr 19, 2020 · 9 commits to master since this release

Added a new and useful Liquid tag filter: if_null that can save a lot of work and make some files clearer.

See if-null-filter.md file in the Tests folder to see how it works.

Assets 3

@jmalarcon jmalarcon released this Apr 13, 2020 · 10 commits to master since this release

Added support for the following Liquid filters not available in 3.0.0 (because they weren't available in DotNetLiquid):

  • concat: it works with arrays or any IEnumerable colleciton. It adds a custom optional parameter to indicate in you want to remove duplicated elements, for example: {{ relatedposts | concat: myposts, true}}. That saves you the use of the uniq filter for that, and is faster.
  • reverse: Reverses the order of the items in an array or any IEnumerable.

and added two new useful filters to work with URLs:

  • relative_url: generates the url relative to the root folder of the site to the specified path . For example if you call it inside a content in the /blog folder: {{ "images/logo.jpg" | relative_url }} it'll return: /blog/images/logo.jpg.
  • absolute_url: it's exactly the same but including the full protocol and domain: {{ "images/logo.jpg" | absolute_url }} --> https://www.yoursite.com/blog/images/logo.jpg.

Both of them work with relative paths, paths with ../, root related paths with ~/and absolute paths with the full URL (for example, external images).

Important: make sure you remove the WhereFilter.dll file in the /bin/MIISCustomFilters folder. Now its name is MIISLiquidFilters.dll and includes all the Liquid filters in the same DLL.

Assets 3

@jmalarcon jmalarcon released this Mar 30, 2020 · 15 commits to master since this release

Version 3.0 is here (at last)!!! 😱

It's rebuilt almost from scratch to add tons of new features and enhancements.

I've been using it for several real web sites for the last 6 months, some of them with hundreds of thousands of unique users per month, so it's thoroughly tested in real life conditions.

Unfortunately I didn't have the time yet to document everything on the main site, but I'll do it as soon as I can. Anyway you can see almost all the features in action in the Tests folder of the main repository. Just copy that folder to your MIIS site and you can play and test with it.

🆕 New features

This is a, more or less, exhaustive list of new features:

  • Support for Liquid Tags and syntax. Mostly compatible with Jekyll and the likes for the simple migration of templates (note that advanced templates that use Ruby extensions and other specific things would need a more laborious adaptation).

  • You can easily create your own liquid tags and filters in .NET asseblies (DLLs). Automatic detection and use.

  • Templates:

    • Added inheritance support to template's layouts. Just add a Layout property in the front-matter of the layout. Prevents circular references.
    • If you specify TemplateName: raw in the Front-Matter, then no template will be used and you'll get the final raw HTML for the requested page. useful for debugging and to return raw information, for example for returning JSON or XML files (RSS, Atom).
    • When you use TemplateName:raw you can also add a new mime field in the page (it's a Front-Mater only field) that allows you to specify the MIME type of the raw content that is going to be returned from the current page. This parameter can be useful to return formatted text that gets generated from a raw .mdh file (for example, to create special kinds of files, such as RSS, JSON... directly from MIIS).
    • Now you can disable the current template in a page by specifying TemplateName: none in the Front-Matter (or web.config in any folder). This will use the default HTML5 basic template that only includes de basic tags, a CSS file and the content. This is useful for testing purposes or to create some basic pages for special purposes.
  • Front-Matter sources (FMS): they're a way to create data sources for your Front-Matter fields. The work in global fields in web.config too. I've included several useful FMS out of the box:

    • FilesFromFolder: processes and retrieves information form files in any folder for a lot of different uses: you can have a posts collection for a blog (with automatic tags and categories), you can create language resources for multilingual templates and sites, maintain and reuse information for authors...
    • PaginatorForFolder: a FMS that eases the creation of paged content from files, compatible with the one in Jekyll.
    • CategsFromFolder: retrieves the categories for files in a folder. Useful to work with documentation, blogs... Compatible with the paginator FMS.
    • TagsFromFolder : retrieves the tags for files in a folder. Useful to work with documentation, blogs... Compatible with the paginator FMS.
  • File Processing Fields now can act as components too, being wrapped in specific layouts for reuse, using the new component field.

  • Many new possibilities for inserting files in your content or in templates:

    • Insert a sub-file in the data context of the current file (using the Front-Matter data of the current file).
    • Insert a sub-file in its own data context (keeping its Front-Matter data).
    • Insert a sub-file without using any context (no data used for the processing of the file and therefore all the placeholders are deleted in the final HTML).
    • Insert a sub-file using the data context of another file. Useful for keeping data-only files that can be resused all over the place.
  • Now you can use any parameter received form field, cookie or server variable in your content through a conventional placeholder. For example {{HTTP_USER_AGENT}} or the name of a field sent in the GET or POST methods. The use of placeholders that refer to any of those parameters (query string, form data, cookies or server variables) automatically disable the caching mechanism because they vary on each request. So use them carefully if caching is important for you. For security reasons if you don't include any of them in your content they are dismissed, so never mind. If you create a custom Front-Matter Source and want to take advantage of query or form parameters in cached pages, generating an individual cache for them, you must declare them accordingly (see examples).

  • New standard fields available to use in templates and content pages:

    • {{FileExt}}: current content file extension.
    • {{Url}}: current file absolute URL from the root folder (not including domain, i.e: /folder/file.md).
    • {{UrlNoExt}}: current file absolute URL without the file extension (i.e: `/folder/file).
    • {{Domain}}: current domain that is serving the site, including the port if it's not the default one (80 or 443) (ie: www.mydomain.com).
    • {{BaseUrl}}: protocol + domain (i.e: https://www.mydomain.com)
    • {{Now}} and {{Today}}: return the server's current date and time in the short form for the current user's locale (i.e.: 30/03/2020 18:27:17). You can format dates using the date filter. By default it uses the .NET formatting instead of Ruby formatting (typical of Liquid), but you can change that (see the DateFormat global parameter below).
    • {{Time}}: Just the time (i.e.: 18:27:07).
    • {{Content}}: The final HTML content, WITHOUT the template and WITH liquid tags processed. Now, you can reuse this field in any content, not just in templates. Useful for processing files with Front-Matter Sources.
    • {{Date}}: the date for a file. You can manually specify it in the Front-Matter or it will use the creation date for the file.
    • {{DateCreated}}: the creation date for the file.
    • {{DateModified}}: the modification date for the file.
    • {{dir}}: the current directory absolute path from the root where the file is located (i.e.: /midir/muSubDir/).
    • {{TemplateName}}: sets or gets the name of the template used for the current file.
    • {{Layout}}: sets or gets the name of the current layout of the template used for the current file.
    • {{excerpt}}, {{description}}, {{summary}}: fields that can be used to specify a summary for the current file (read in the content or template, and write in the Front-Matter). If more than one is used, the precedence is: {{excerpt}}, {{description}} and {{summary}}.
    • {{UniqueId}}:
    • {{isauthenticated}}: true if the current user has been authenticated in the site using any of the supported methods (Forms, Windows, OAuth...) or false if not.
    • {{authtype}}: the type of authentication performed.
    • {{username}}: the name of the currently authenticated user.
  • Enable or disable caching per file, not only globally as in 2.x. You can have caching enabled globally in web.config and at the same time disable it only for specific files, or the other way around. The parameter to enable/disable caching is now called Caching. The old UseMDCaching parameter has been deprecated. It still works, but it can disappear in future updates. Use Caching instead.

  • More advanced Markdown extensions enabled by default (if in doubt about their function, see Markdig's documentation to know more about them):

    • Abbreviations
    • AutoIdentifiers
    • Citations
    • CustomContainers
    • DefinitionLists
    • EmphasisExtras
    • Figures
    • Footers
    • Footnotes
    • GridTables
    • Mathematics
    • MediaLinks
    • PipeTables
    • ListExtras
    • TaskLists
    • Diagrams
    • AutoLinks
    • GenericAttributes
  • You can now use the new EnableMDExtensions field (globally or per file) to enable some more Markdown extensions if needed. Just add them in a parameter with a "+" sign to separate them (case insensitive). For example: <add key="MIIS:EnableMDExtensions" value="hardlinebreak+bootstrap+smartypants"/>. The available extra extensions are

    • hardlinebreak: Use softline breaks in Markdown as Hardline breaks in HTML
    • bootstrap: Adds some Bootstrap classes to the resulting HTML. See this
    • smartypants: Translates plain ASCII punctuation characters into “smart” typographic punctuation HTML entities. See this
    • nofollowlinks: Adds rel=nofollow to all links rendered to HTML
    • nohtml: Disables the HTML support in the markdown processor (for constraint/safe parsing), so you couldn't mix HTML into your Markdown content.
    • globalization: Adds support for right-to-left content by adding appropriate html attributes.
    • nonascii-noescape: Disable URI escape with % characters for non-US-ASCII characters in order to workaround a bug under IE/Edge with local file links containing non US-ASCII chars. DO NOT USE OTHERWISE.
  • Added the naming and dateformat global parameters.

    • They allow to change the default behavior of Liquid tags when processing placeholders and dates.
    • The valid values for both parameters are csharp and ruby. The default values if not specified are ruby for naming (allows to be more compatible with jkyll templates) and csharp for dates (C# developers are much more comfortable with .NET formatting than with Ruby`s which in fact is C's).
    • They only work if set in the root web.config file. They're stablished once for the whole application on the first page load.
    • C# date formatting reference
    • Ruby date formatting reference
  • Added support for non-ASCII header autolinks.

  • Fixed extra new line added at the beginning of the content because of Front-Matter removal. No extra new line is added now.

  • If you want to invalidate a field you can use null (C#) or nil (Ruby). Both will do. However, if a field is not defined anywhere (does not exit), it's default value is neither null nor nil  but an empty string "". Anyway you can check for the existence of a field in a template (or directly in the content) with {% if miField %} The parameter exists and has a value {% endif %}, but if you explicitly want to check for the inexistence of the field you must write: {% if miField == "" %} The parameter does not exist and has a value {% endif %}.

Breaking changes

  • Indented code blocks not supported in this new version due to the new pipeline for processing and rendering the contents and templates. This enables safely mixing Markdown and HTML without you needing to take into account the indented code block rules. Anyway, I'm not a huge fan of indented code blocks anyway because they are not explicit and it's easy to create one inadvertently so, IMHO, they should be removed from the Markdown specification altogether. In MIIS' case, however, it's now a mandatory exclusion, so take it into account.
  • The File Processing Fields (FPF) (files included in other files by referring them in the Front-Matter) now resolve the tags before injecting the content. They resolve the tags in the injected file context (using the fields in their Front-Matter, not in the mother file Front-Matter).
  • Removed the allowDownloading global option and the corresponding "download" query string parameter. Now you can't download the original files.
Assets 3

@jmalarcon jmalarcon released this Apr 6, 2019 · 115 commits to master since this release

This is the last intended update until the next major version 3.0.0 that will have major breaking changes.

What's new?

  • ⚠️ Removed the allowDownloading option and the corresponding "download" query string parameter.
  • Now you can disable the current template in a page by specifying `TemplateName: none´ in the Front-Matter. This will use the default HTML5 basic template that only includes de basic tags, a CSS file and the content. This is useful for testing purposes or to create some basic pages for special purposes.
  • Raw contents: If you specify `TemplateName: raw´ in the Front-Matter, then no template will be used and you'll get the final raw HTML for the requested page. useful for debugging and to return raw information.
  • MIME type: When you use the "raw" template to get raw contents from a file, you can also add a new {{mime}} parameter in the page (it's a Front-Mater only field) that allows you to specify the MIME type of the raw content that is going to be returned from the current page. This parameter can be useful to return formatted text that gets generated from a raw .mdh file.
  • 6 new standard fields available to use in templates and content pages:
    • {{Url}}
    • {{NoExtUrl}}
    • {{Domain}}
    • {{BaseUrl}}
    • {{Now}}
    • {{Time}}
  • Fixed extra new line added at the beginning of the content because of Front-Matter removed. No extra new line is added now.
Assets 3

@jmalarcon jmalarcon released this Apr 5, 2019 · 126 commits to master since this release

Fixed a minor bug that happened when there were a $& or similar combination inside a piece of content.

See issue #28 .

Assets 3

@jmalarcon jmalarcon released this Aug 20, 2018 · 133 commits to master since this release

  • Added the new "HttpStatusCode" property that allows pages to send an specific status code to the client, such as 404, 410, 500, etc... in order to create special pages with specific purposes.
  • Added 404 sample page to the release files.
  • Updated templates to latest jQuery version
  • Updated markdig Markdown library to the latest version
Assets 3

@jmalarcon jmalarcon released this Mar 24, 2018 · 147 commits to master since this release

  • Added the new "Published" property that allows you to prevent certain files or entire folders to be rendered when requested.
  • Squashed a bug with templates' caching preventing some files to invalidate their cache
Assets 3

@jmalarcon jmalarcon released this Mar 6, 2018 · 153 commits to master since this release

Read the full documentation at https://miis.azurewebsites.net/

- Breaking changes from v1.0.x

  • New app DLL name: MIISHandler.dll instead of the old one IISMarkdownHandler.dll. Make sure you delete the old one before updating! You must change the handlers section in your web.config file. Just copy it from the downloaded MISS released files.
  • Placeholders now use double curly braces ({{field}}) instead of just one. Upgrade your templates before updating.
  • The Markdown-Template parameter doesn't exist anymore. Now it uses two independent parameters for the template location and the layout, being much more flexible. See configuration/settings.
  • the BaseFolder field is deprecated. Use ~/ instead.
  • The BaseFolder and TemplateBaseFolder fields do not include a slash / at the end. This makes the paths more readable.
  • The UseMDCaching and AllowEmojis parameter's value are "1" by default (enabled), so you don't need to specifcy them most of the time.

- What's new

  • Includes in templates. Now you can reuse any part of your template to define different layouts using the same base code. The include files can include other files too (no circular-references allowed).
  • "Fragments". This powerful new concept allows you to define several contents to be located in the same layout to form a single page, even with optional parts.
  • Front Matter: Define any parameter in the Front-Matter of a file and use it inside the content or in the current template. Re-define any global parameter or field to be applied differently in any page. For example, you can define something as simple as the title or author of the page, or even change the layout it uses to render itself. Front-Matter values take precedence over values defined globally.
  • MIIS: prefix to define global parameters & fields in web.config files. To avoid conflict with parameters of the same name in other software you may be using. The use of this prefix is optional but recommended. It'll take precedence over the non-prefixed parameters with the same name in case of conflict.
Assets 3
You can’t perform that action at this time.