?> January 2024 - Addeos

Monthly Archive 30 January 2024

Generating PDF from Markdown with Grip

Markdown is a popular lightweight markup language used for formatting plain text documents. While Markdown excels in simplicity and ease of use, there are scenarios where the need arises to convert Markdown files to more portable and shareable formats, such as PDF. PDFs provide a consistent and printable representation of documents, making them an ideal choice for sharing content across various platforms.

However, when working with Markdown files containing images, the process of converting them to PDF can sometimes become challenging. The inclusion of images adds an extra layer of complexity to the conversion process, as certain tools may not seamlessly handle the transition from Markdown to PDF.

In this tutorial, we'll explore the use of Grip, a Markdown previewer, to generate a PDF file from a Markdown document. Additionally, we'll address the common concerns associated with images in Markdown files and provide solutions to ensure a smooth conversion process.

Whether you're looking to share documentation, create presentation materials, or simply preserve the formatting of your Markdown content for offline use, the ability to generate PDFs becomes invaluable. Let's dive into the step-by-step guide to harnessing Grip's capabilities for this purpose, and learn how to overcome challenges related to images in the Markdown-to-PDF conversion process.

Step 1: Install Grip

Grip is a lightweight GitHub-flavored Markdown previewer. You can install it using Python's pip package manager:

pip install grip

Step 2: Create a Markdown File

Create a Markdown file (e.g., example.md) containing your content. You can use any text editor to create and edit this file.

Step 3: Preview with Grip

Run Grip to preview your Markdown file:

grip example.md

This command will start a local server and provide you with a URL (e.g., http://localhost:6419). Open this URL in your web browser to see how your Markdown file will be rendered.

Step 4: Save as PDF

After previewing your Markdown file, you can save the rendered HTML as a PDF using your browser's print functionality.

In Google Chrome:

  • Click on the three dots in the top-right corner.
  • Select "Print..."
  • Change the destination to "Save as PDF."
  • Click "Save" to save the PDF file.

In Firefox:

  • Click on the three horizontal lines in the top-right corner.
  • Select "Print..."
  • Choose "Save to File" as the printer.
  • Click "Print" and save the PDF file.


Now you have successfully generated a PDF file from your Markdown file using Grip and printed it as a PDF.

Enhancing Magento 2 JavaScript Modules with Mixins: A Guide


Magento 2 provides a robust and extensible architecture that allows developers to customize and extend functionality easily. One powerful feature for extending JavaScript modules is the use of mixins. In this article, we will explore how to add a mixin to an existing JavaScript module in Magento 2, drawing parallels to the familiar concept of writing PHP plugins for adding specific treatments after, before or around existing functions.

Understanding Mixins in Magento 2:

Mixins in Magento 2 JavaScript development enable developers to add or override methods in existing classes. This approach promotes code reusability and allows for seamless customization without modifying the core codebase. Just as PHP plugins can extend and modify the behavior of existing PHP classes, mixins empower JavaScript developers to enhance the functionality of JavaScript modules in a clean and modular way.


Before diving into the mixin implementation, ensure you have a basic understanding of Magento 2 JavaScript development and are familiar with the structure of the module you intend to extend.

Step 1: Create Your Mixin File:

In your custom module, create a JavaScript mixin file. This file should follow the naming convention "vendor/namespace/view/frontend/web/js/mixin-name-mixin.js". This file will contain the code for your mixin.

Let's say my module vendor and namespace is Addeos_MyModule.

And I want to create a mixin for this core file : vendor/magento/module-checkout/view/frontend/web/js/model/shipping-save-processor/default.js

I am going to create this file:
I respect the same folder hierachy.

Here is the content of that file:

define(['jquery', 'mage/utils/wrapper'], function ($, wrapper) {
    'use strict';

    return function (defaultShippingSaveProcessor) {
        defaultShippingSaveProcessor.saveShippingInformation = wrapper.wrapSuper(
            function () {
                console.log('here, I can do want I want.');
                return this._super();
        return defaultShippingSaveProcessor;

Step 2: Apply the Mixin to the Target Module:

To apply the mixin to the target module, create a requirejs-config.js file in your module's view/frontend directory.

var config = {
    config: {
        mixins: {
            'Magento_Checkout/js/model/shipping-save-processor/default': {
                'Addeos_MyModule/js/checkout/model/shipping-save-processor/default-mixin': true,


Adding a mixin to an existing JavaScript module in Magento 2 is a powerful way to customize functionality without modifying core code. Drawing parallels to PHP plugins, mixins offer a clean and modular approach to extending JavaScript modules, ensuring maintainability and ease of future upgrades. Incorporate this technique into your Magento 2 development toolkit to create flexible and scalable solutions.

Magento 2 Security Best Practices

Safeguarding Your E-Commerce Store


In the ever-evolving landscape of e-commerce, ensuring the security of your Magento 2 store is paramount. This article will guide you through essential security best practices, helping you protect your online business and instill confidence in your customers.

1. Keep Magento 2 Updated

Regularly updating your Magento 2 installation is the first line of defense against potential vulnerabilities. Magento frequently releases security patches and updates to address known issues. Make it a practice to stay current with the latest versions.

Check the published versions of Adobe Commerce here. It contains the release dates of each minor, patch, and security release, as well as the end of support dates.

Take a look at the lifecycle policy here.

2. Secure Admin Access

  • Unique Admin URL: Change the default admin URL to reduce the risk of brute-force attacks.
  • Strong Passwords: Enforce strong password policies for admin accounts, including a combination of letters, numbers, and special characters.

3. SSL Implementation

Ensure that your Magento 2 store uses Secure Socket Layer (SSL) to encrypt data transmission. This is crucial for securing sensitive information such as customer details and payment transactions.

4. Regular Security Audits

Performing regular security audits is essential to identify vulnerabilities and address them promptly. Consider employing third-party security tools or services to conduct thorough assessments.

5. File Permissions and Ownership

Set appropriate file permissions and ownership for your Magento 2 installation. Limit access to critical files and directories, reducing the likelihood of unauthorized access or modification.

6. Web Application Firewall (WAF)

Implement a Web Application Firewall to protect your store from common web threats. A WAF can filter and monitor HTTP traffic between a web application and the Internet, providing an additional layer of security.

7. Two-Factor Authentication (2FA)

Enforce Two-Factor Authentication for admin accounts to add an extra layer of security. This ensures that even if login credentials are compromised, an additional verification step is required.

8. Regular Backups

Frequently back up your Magento 2 store, including databases and media files. In the event of a security breach or data loss, having recent backups can significantly reduce downtime and data loss.

9. Extension Security

Carefully vet and only install reputable extensions from trusted sources. Regularly update installed extensions to benefit from security patches and improvements.

10. Educate Your Team

Security is a collective effort. Educate your team members on security best practices, including recognizing phishing attempts, safeguarding login credentials, and reporting suspicious activities promptly.


By implementing these Magento 2 security best practices, you fortify your e-commerce store against potential threats and build a foundation of trust with your customers. Stay vigilant, stay secure, and keep your online business thriving in a secure digital environment.

Exciting News: My First Magento Extension is Now Live on the Marketplace!

I am thrilled to share some exciting news with you! Today marks a significant milestone for me as I proudly announce the deployment of my very first extension on the Adobe Magento Marketplace.

This extension empowers you to anonymize your database with a new CLI command, ensuring that sensitive customer privacy details are obfuscated for enhanced security and GDPR compliance.

I wrote an article in the past. Here it is : https://www.addeos.com/magento-2-database-anonymization-module

The module is still available on packagist here : https://packagist.org/packages/addeos/anonymize

And you can find it on the Adobe Magento Marketplace here: https://commercemarketplace.adobe.com/addeos-anonymize.html