Skip to content

Commit

Permalink
feat: add support the Markdown *.md files in the template
Browse files Browse the repository at this point in the history
  • Loading branch information
webdiscus committed Dec 3, 2024
1 parent f8ad5c9 commit b3ff1bd
Show file tree
Hide file tree
Showing 82 changed files with 7,606 additions and 274 deletions.
24 changes: 21 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Change log

## 4.6.0 (2024-12-03)

- feat: add support the Markdown `*.md` files in the template engines: `eta`, `ejs`, `handlebars`, `pug`.
The markdown file can be included in the HTML template, e.g. `Eta`:
```html
<html>
<head>
<!-- Load Markdown and Highlighting styles -->
<link href="github-markdown-css/github-markdown-light.css" rel="stylesheet" />
<link href="prismjs/themes/prism.min.css" rel="stylesheet" />
</head>
<body class="markdown-body">
<!-- Load Markdown file -->
<%~ include('readme.md') %>
</body>
</html>
```

## 4.5.3 (2024-11-28)

- fix: issue by HMR when CSS contains Tailwind-like style names with backslashes
Expand All @@ -12,12 +30,12 @@
## 4.5.1 (2024-11-28)

- fix: if used `splitChunks.chunks` option then this options will be removed and will be displayed a warning
This option make no sense, because we will split only scripts.
This option makes no sense, because we will split only scripts.
- docs: update readme

## 4.5.0 (2024-11-25)

- feat: add limited support the HMR for styles imported in JavaScript files
- feat: add support the HMR for styles imported in JavaScript files
- feat: add new `css.hot` option to enable HMR for styles

## 4.4.3 (2024-11-23)
Expand All @@ -26,7 +44,7 @@

## 4.4.2 (2024-11-18)

- fix: add Exception when used `splitChunks` and occurs the error: Can't resolve a CSS file in template.
- fix: add Exception when used `splitChunks` and occurs the error: Can't resolve a CSS file in template
- fix: correct Exception message when a source CSS file is not found

## 4.4.1 (2024-11-05)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Advanced alternative to [html-webpack-plugin](https://github.com/jantimon/html-w
- **Renders** the [template engines](#template-engine) "out of the box":
[Eta](#using-template-eta), [EJS](#using-template-ejs), [Handlebars](#using-template-handlebars), [Nunjucks](#using-template-nunjucks), [Pug](#using-template-pug), [Tempura](#using-template-tempura), [TwigJS](#using-template-twig), [LiquidJS](#using-template-liquidjs).
It is very easy to add support for any template engine.
- Supports including of Markdown `*.md` files in the template.
- **Source files** of [`script`](#option-js) and [`style`](#option-css) can be specified directly in HTML:
- `<link href="./style.scss" rel="stylesheet">`\
No longer need to define source style files in Webpack entry or import styles in JavaScript.
Expand Down Expand Up @@ -209,6 +210,7 @@ If you have discovered a bug or have a feature suggestion, feel free to create a

## 🔆 What's New in v4

- **NEW** including of Markdown `*.md` files in the template. (since `v4.6.0`).
- **NEW** added supports the [HMR for CSS](#option-css-hot) (since `v4.5.0`).
- **NEW** added supports the [multiple configurations](https://webpack.js.org/configuration/configuration-types/#exporting-multiple-configurations).
- **SUPPORTS** Webpack version `5.96+` (since `v4.2.0`).
Expand Down
29 changes: 29 additions & 0 deletions examples/markdown-to-html/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Markdown to HTML

Use the [HTML Builder Plugin](https://github.com/webdiscus/html-bundler-webpack-plugin) for Webpack to render Markdown files `*.md` to HTML.

Required to install additional dependencies:

- markdown-it (render Markdown)
- prismjs (highlighting)
- parse5 (highlighting dependency)
- github-markdown-css (GitHub styles)
- handlebars (optional, if not used default template engine `eta`)

> **Note**
>
> The template engines supports Markdown: `eta`, `ejs`, `handlebars`, `pug`.
> This example uses the `handlebars` template engine to load the markdown file.
## View and edit in browser

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/markdown-to-html?file=webpack.config.js)

## How to use

```sh
git clone https://github.com/webdiscus/html-bundler-webpack-plugin.git
cd examples/markdown-to-html/
npm install
npm run view
```
Loading

0 comments on commit b3ff1bd

Please sign in to comment.