File tree Expand file tree Collapse file tree 7 files changed +112
-2
lines changed
Expand file tree Collapse file tree 7 files changed +112
-2
lines changed Original file line number Diff line number Diff line change 1+ # Blog
Original file line number Diff line number Diff line change 1- # Tutorials
1+ # Welcome to MkDocs
2+
3+ For full documentation visit [ mkdocs.org] ( https://www.mkdocs.org ) .
4+
5+ ## Commands
6+
7+ * ` mkdocs new [dir-name] ` - Create a new project.
8+ * ` mkdocs serve ` - Start the live-reloading docs server.
9+ * ` mkdocs build ` - Build the documentation site.
10+ * ` mkdocs -h ` - Print help message and exit.
11+
12+ ## Project layout
13+
14+ mkdocs.yml # The configuration file.
15+ docs/
16+ index.md # The documentation homepage.
17+ ... # Other markdown pages, images and other files.
Original file line number Diff line number Diff line change 1+ # Tag index
2+ <!-- material/tags -->
Original file line number Diff line number Diff line change 1+
2+ import re , functools , unicodedata
3+
4+ RE_HTML_TAGS = re .compile (r'</?[^>]*>' , re .UNICODE )
5+ RE_INVALID_SLUG_CHAR = re .compile (r'[^\w\- ]' , re .UNICODE )
6+ RE_WHITESPACE = re .compile (r'\s' , re .UNICODE )
7+
8+ def _make_slug (text , sep , ** kwargs ):
9+ slug = unicodedata .normalize ('NFC' , text )
10+ slug = RE_HTML_TAGS .sub ('' , slug )
11+ slug = RE_INVALID_SLUG_CHAR .sub ('' , slug )
12+ slug = slug .strip ().lower ()
13+ slug = RE_WHITESPACE .sub (sep , slug )
14+ return slug
15+
16+ def _make_slug_short (text , sep , ** kwargs ):
17+ words = _make_slug (text , sep , ** kwargs ).split (sep )
18+ return sep .join (words [:5 ])
19+
20+ def slugify (** kwargs ):
21+ if 'short' in kwargs and kwargs ['short' ]:
22+ return functools .partial (_make_slug_short , ** kwargs )
23+ return functools .partial (_make_slug , ** kwargs )
Original file line number Diff line number Diff line change 1+ from textwrap import dedent
2+ import urllib .parse
3+ import re
4+
5+ x_intent = "https://twitter.com/intent/tweet"
6+ fb_sharer = "https://www.facebook.com/sharer/sharer.php"
7+ include = re .compile (r"blog/[1-9].*" )
8+
9+ def on_page_markdown (markdown , ** kwargs ):
10+ page = kwargs ['page' ]
11+ config = kwargs ['config' ]
12+ if not include .match (page .url ):
13+ return markdown
14+
15+ page_url = config .site_url + page .url
16+ page_title = urllib .parse .quote (page .title + '\n ' )
17+
18+ return markdown + dedent (f"""
19+ [Share on :simple-x:]({ x_intent } ?text={ page_title } &url={ page_url } ){{ .md-button }}
20+ [Share on :simple-facebook:]({ fb_sharer } ?u={ page_url } ){{ .md-button }}
21+ """ )
Original file line number Diff line number Diff line change 11site_name : H2 invent Docs
22site_url : https://h2-invent.github.io/docs
33theme :
4- name : material
4+ name : material
5+ features :
6+ - navigation.indexes
7+
8+ plugins :
9+ - search
10+ - blog :
11+ blog_toc : true
12+ archive_date_format : MMMM yyyy
13+ categories_allowed :
14+ - Holidays
15+ - News
16+ authors_profiles : true
17+ pagination_per_page : 5
18+ archive_pagination_per_page : 10
19+ categories_pagination_per_page : 10
20+ post_slugify : !!python/object/apply:ext.slugs.slugify
21+ kwds :
22+ short : true
23+ - meta
24+ - tags
25+ - rss :
26+ match_path : " blog/posts/.*"
27+ date_from_meta :
28+ as_creation : date.created
29+ as_update : date.updated
30+
31+ extra :
32+ social :
33+ - icon : fontawesome/brands/mastodon
34+ name : squidfunk on Mastodon
35+ link : https://fosstodon.org/@squidfunk
36+
37+ hooks :
38+ - hooks/socialmedia.py
39+
40+ markdown_extensions :
41+ - attr_list
42+ - pymdownx.emoji :
43+ emoji_index : !!python/name:material.extensions.emoji.twemoji
44+ emoji_generator : !!python/name:material.extensions.emoji.to_svg
45+
46+ nav :
47+ - Home : index.md
48+ - Tags : tags.md
49+ - Blog :
50+ - blog/index.md
51+ - blog/tags.md
You can’t perform that action at this time.
0 commit comments