ukarim / ngx_markdown_filter_module Goto Github PK
View Code? Open in Web Editor NEWMarkdown-to-html nginx module
License: MIT License
Markdown-to-html nginx module
License: MIT License
Compiled successfully into nginx, run it and it will stop transform the whole markdown file into html format. my nginx.conf is as follows,
#user nobody;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 2048; # original 1024
}
http {
include mime.types;
default_type application/octet-stream;
charset utf-8;
# try to correct ngx_markdown_filter_module
client_max_body_size 100M;
# Set the buffer size for reading client request body
client_body_buffer_size 10M;
# Set the buffer size for reading from the upstream server
proxy_buffer_size 64k;
# Set the number and size of buffers used for reading from the upstream server
proxy_buffers 8 64k;
# Set the size of the buffer used for reading from the upstream server when the connection is busy
proxy_busy_buffers_size 128k;
# Set the timeout for reading from the upstream server
proxy_read_timeout 300s;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 8888;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
# Render Markdown files as HTML pages using ngx_http_markdown_filter_module
location ~ \.md$ {
add_header Content-Type 'text/html';
markdown_filter on;
markdown_template /usr/local/nginx/html/template.html;
# markdown_template html/template.html;
# sub_filter_types *;
# sub_filter '</body>' '<div style="padding: 20px;">$markdown$</div></body>';
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
Hello, nice work on the module. Is it stable? If it is, please tag a release version.
It currently sets the title via JS looking through {{content}}
. That is helpful but its not great for SEO as some indexers would miss the title that way and they can’t do anything unique to the content.
However, if this supported metadata for the content somehow like front matter in foo.md
(or external .foo.json but front matter feels more ideal).
---
title: title here
meta:
robots:
- index
- nofollow
description: "description here"
---
# My page
Lorum Ipsom …
<meta charset="utf-8">
<meta name="robots" content="{{meta.robots}}">
<meta name="description" content="{{meta.description}}">
<title>{{title}}</title>
<meta charset="UTF-8">
<meta name="robots" content="index, nofollow">
<meta name="description" content="description here">
<title>title here</title>
Support for doing 1 or more link/script/etc tags could be a round 2 thing if it too crazy but Ienvision like:
TAG_NAME::
- attr1: val1
attr2: val2
- attr1: val3
attr2: val4
- attr3: val5
attr4: val6
.content : "I am content"
Rendering as:
<TAG_NAME attr1="val1" attr2="val12"/>
<TAG_NAME attr1="val1" attr3="val14"/>
<TAG_NAME attr3="val4" attr5="val15"/>I am content</TAG_NAME>
Perhaps the loop syntax can be borrowed from a common existing template format.
Getting the same issue as this.
Site usable again after recompiling without ngx_markdown_filter_module.
On openresty-1.21.4.2 ( from github).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.