npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mdfc-map-to-html

v1.3.3

Published

markdown to html impl for md-file-converter

Downloads

16

Readme

mdfc-map-to-html

Build Status semantic-release Conventional Commits Commitizen friendly npm version

An implementation package for md-file-converter.

This implementation output super basic .html files.

Internals links insides markdown files should point to .md files. This impl handle the change to .html.

installation

In the repository containing your markdown documents, add this package to devDependencies :

npm i -D mdfc-map-to-html

usage

Invoke the CLI with the following :

node ./node_modules/.bin/mdfc convert 'mdfc-map-to-html' '<markdown-files-path>'

html files will be created in the same directory as the markdown files.

If you want to create them in another directory you can add a --dest option with the destination path, for example :

node ./node_modules/.bin/mdfc convert 'mdfc-map-to-html' 'tests/actual-files/faq/**/*.md' --dest 'html-output/'

but the markdown structure will not be preserved, so be careful of .md file naming, each filename must be unique.

css support

You can define custom css stylesheet injection with front-matter in your markdown files.

See tests/actual-files/css-support/test-news-with-css.md for example.

The idea is to define the stylesheet values in the front-matter to add it to the generated html during the mapping phase.

Your yaml could look like this :

htmlHead:
    links:
        - href: mobile.css
          rel: stylesheet
          media: all
        - href: print.css
          rel: stylesheet
          media: print
        - href: desktop.css
          rel: stylesheet
          media: 'screen and (min-width: 600px)'
        - href: favicon32.png
          rel: icon
        - href: favicon72.png
          rel: apple-touch-icon-precomposed
          sizes: 72x72

You can deal with favicon here also.

An <article> tag is added to wrap the generated content inside the document <body>.

A class name can be added to the <article> tag, just add a containerClass property to the htmlHead property in the yaml like that :

htmlHead:
    containerClass: 'my-class'
    links:
        - href: mobile.css
          rel: stylesheet
          media: all
        - href: print.css
          rel: stylesheet
          media: print

<title> support

Like css support, you can define your document <title> with front-matter in your markdown files.

The html document <title> is very important for SEO, choose it carefully.

To specify the <title> value, add a title property in the front-matter like this :

htmlHead:
    title: 'git-sizer publié par GitHub'

If you don't, the <title> tag value is set with the markdown file basename. For example if your markdown file is named my-article.md, you will get <title>my-article</title>.

<meta> tags support

Like css support, you can define your document <meta> with front-matter in your markdown files.

The idea is to define the meta tags values in the front-matter to add it to the generated html during the mapping phase.

Your yaml could look like this :

htmlHead:
    metaTags:
        - name: description
          content: 'my uber document'
        - name: viewport
          content: 'width=device-width, initial-scale=1, minimal-ui'
        - property: 'og:type'
          content: website
        - httpEquiv: 'Expires'
          content: '0'

The html <meta> tags are very important to manage for :

See MDN documentation for further information.

<script> tags support

Like css support, you can define your document <script> with front-matter in your markdown files.

Same as above your yaml could look like this :

htmlHead:
    scripts:
        - src: 'my-script.js'
          async: true
        - src: 'http://cdn.domain.tld/dependency.js'
          defer: true
          crossorigin: 'anonymous'
        - text: 'document.title = "a new title";'

and it will output at the end of <head> tag :

<script src="my-script.js" async></script><script src="http://cdn.domain.tld/dependency.js" defer crossorigin="anonymous"></script><script>document.title = "a new title";</script>

See MDN documentation for further information.