1
0
Fork 0
mirror of https://github.com/mat-1/matdoesdev.git synced 2025-08-02 14:46:04 +00:00

update matdown™️

This commit is contained in:
mat 2022-04-08 18:09:13 +00:00
parent 3ab6aa751c
commit 6fffd3ed38
16 changed files with 119 additions and 27 deletions

View file

@ -2,6 +2,9 @@
:root {
--background-color: #010502;
/* used for gradients */
--background-color-transparent: #01050200;
--background-color-alt: #111;
--background-color-alt-2: #222;
--background-color-alt-3: #333;

View file

@ -7,11 +7,16 @@
<a href="/blog/post/{post.slug}" class="preview-anchor">
<article>
<h2>{post.title}</h2>
<div class="disappearing-text-preview" />
<div class="preview">{@html post.html}</div>
</article>
</a>
<style>
article {
position: relative;
}
article > .preview {
display: block;
overflow: hidden;
@ -20,12 +25,24 @@
-webkit-line-clamp: 2; /* number of lines to show */
line-clamp: 2;
-webkit-box-orient: vertical;
height: 3.7em;
height: 5em;
padding: 0;
margin: 0;
}
.disappearing-text-preview {
background: linear-gradient(
var(--background-color-transparent) 0%,
var(--background-color) 100%
);
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 70%;
}
.preview-anchor {
color: inherit;
text-decoration: none;

View file

@ -15,40 +15,99 @@ export function markdownToHtml(md: string, baseUrl?: string): string {
const centered: marked.TokenizerExtension = {
name: 'centered',
level: 'block', // Is this a block-level or inline-level tokenizer?
level: 'block',
start(src: string) {
// the marked typings want a `number` and we're returning a `number | undefined` :(
// the marked typings want a `number` and we're returning a `number | undefined` so we have to do this :(
return src.match(/\|\|/)?.index as number
}, // Hint to Marked.js to stop and check for a match
},
tokenizer(
this: marked.TokenizerThis,
src: string,
tokens: marked.Token[]
): marked.Tokens.Generic | void {
const rule = /^\|\|(.*?)\|\|/
const rule = /^\|\|(.+?)\|\|/
const match = rule.exec(src)
if (match) {
const token = {
// Token to generate
type: 'centered', // Should match "name" above
raw: match[0], // Text to consume from the source
text: match[1].trim(), // Additional custom properties
tokens: [], // Array where child inline tokens will be generated
type: 'centered',
raw: match[0],
text: match[1].trim(),
tokens: [],
}
this.lexer.inline(token.text, token.tokens) // Queue this data to be processed for inline tokens
this.lexer.inline(token.text, token.tokens)
return token
}
},
// @ts-expect-error Marked doesn't include `renderer` in the typings.
renderer(this: marked.TokenizerThis, token: marked.Tokens): string | false {
// @ts-expect-error Property 'parser' does not exist on type 'TokenizerThis'.
return `<div class="center">${this.parser.parseInline(token.tokens)}\n</div>` // parseInline to turn child tokens into HTML
return `<div class="center">${this.parser.parseInline(token.tokens)}\n</div>`
},
}
const left: marked.TokenizerExtension = {
name: 'left',
level: 'block',
start(src: string) {
// the marked typings want a `number` and we're returning a `number | undefined` so we have to do this :(
return src.match(/<-\W/)?.index as number
},
tokenizer(
this: marked.TokenizerThis,
src: string,
tokens: marked.Token[]
): marked.Tokens.Generic | void {
const rule = /^<-\W(.+?)\W<-/
const match = rule.exec(src)
if (match) {
const token = {
type: 'left',
raw: match[0],
text: match[1].trim(),
tokens: [],
}
this.lexer.inline(token.text, token.tokens)
return token
}
},
// @ts-expect-error Marked doesn't include `renderer` in the typings.
renderer(this: marked.TokenizerThis, token: marked.Tokens): string | false {
// @ts-expect-error Property 'parser' does not exist on type 'TokenizerThis'.
return `<div class="markdown-float-left">${this.parser.parseInline(token.tokens)}\n</div>`
},
}
const right: marked.TokenizerExtension = {
name: 'right',
level: 'block',
start(src: string) {
// the marked typings want a `number` and we're returning a `number | undefined` so we have to do this :(
return src.match(/->\W/)?.index as number
},
tokenizer(
this: marked.TokenizerThis,
src: string,
tokens: marked.Token[]
): marked.Tokens.Generic | void {
const rule = /^->\W(.+?)\W->/
const match = rule.exec(src)
if (match) {
const token = {
type: 'right',
raw: match[0],
text: match[1].trim(),
tokens: [],
}
this.lexer.inline(token.text, token.tokens)
return token
}
},
// @ts-expect-error Marked doesn't include `renderer` in the typings.
renderer(this: marked.TokenizerThis, token: marked.Tokens): string | false {
// @ts-expect-error Property 'parser' does not exist on type 'TokenizerThis'.
return `<div class="markdown-float-right">${this.parser.parseInline(token.tokens)}\n</div>`
},
}
marked.use({ renderer, extensions: [centered] })
marked.use({ renderer, extensions: [centered, left, right] })
return marked.parse(md, { baseUrl, breaks: true })
}

View file

@ -60,7 +60,7 @@ Titles:
Image:
!\[description](https://image)
Left image:
,!\[description](https://image)
Right image:
.!\[description](https://image)
<-
Float left
<-

View file

@ -13,7 +13,8 @@ It all started on April 27th, 2020. I was bored and wanted to make a Hypixel For
# madcausebad11
I didnt do anything with this idea until a couple weeks later on May 14th, when I remembered it, and was actually motivated to create it. I asked around on the SkyBlock Community Discord for what it should be called and what it should do, and I decided on calling it madcausebad11 (name chosen by @TatorCheese), and making it say “thats crazy but I dont remember asking” (@Bliziq chose that one) to all posts that mentioned being scammed.
.![Screenshot of a post on the Hypixel Forums where a user named madcausebad11 says "thats crazy but i dont remember asking"](thats-crazy-but-i-dont-remember-asking.png) to make the requests. After an hour of writing code, madcausebad11 was working.
-> ![Screenshot of a post on the Hypixel Forums where a user named madcausebad11 says "thats crazy but i dont remember asking"](thats-crazy-but-i-dont-remember-asking.png) ->
When that had been decided, I started working on the code. It was written in Python, using BeautifulSoup to scrape the web pages and aiohttp to make the requests. After an hour of writing code, madcausebad11 was working.
Less than an hour after the bot started working, it got banned for the reason “spam”.

View file

@ -36,11 +36,11 @@ Another notable thing was that when we searched up the owner of the "Free Nitro"
Anyway, we booted up Windows Sandbox and ran the virus with a process monitor in the background. There were a bunch of references to Python, so it was likely a Python script compiled into an exe.
,![Process monitor](https://i.matdoes.dev/60O9N)
<- ![Process monitor](https://i.matdoes.dev/60O9N) <-
I wasn't sure what it was compiled with, so I tried running unpy2exe on it, but it returned an error telling me to use pyinstxtractor instead, as it was compiled with pyinstaller. After we ran pyinstxtractor on the exe, it returned a folder with a bunch of pyc and pyd (Python bytecode) files.
.![PyInstxtractor](https://i.matdoes.dev/QTWOT)
-> ![PyInstxtractor](https://i.matdoes.dev/QTWOT) ->
![Created on March 2nd](https://i.matdoes.dev/YOYVJ)

View file

@ -3,7 +3,7 @@ title: What Are Domain Hacks?
published: 2019-06-21T17:24:30.105+00:00
---
,![Domain Hack Example](domain-hack-example.png)
<- ![Domain Hack Example](domain-hack-example.png) <-
**A domain hack is a domain in which both the top level domain (TLD) and the second level domain (SLD) are combined to make up a word or phrase.**
For example, matdoes.dev is a domain hack for mat does dev.
Domain hacks are _not_ security-related and they are completely legal.
@ -22,7 +22,7 @@ An advantage to using a domain hack is that your domain is much shorter and ther
# How to Choose a Domain Hack?
Finding a good domain isn't always easy, so I've created a tool hosted on [Repl.it](https://repl.it) that helps you find domain hacks
[.![Domain Hack Generator](domain-hack-generator.png)](https://repl.it/talk/share/Domain-Hack-Finder/15778)
-> [![Domain Hack Generator](domain-hack-generator.png)](https://repl.it/talk/share/Domain-Hack-Finder/15778) ->
[Click here to view the domain hack finder](https://repl.it/talk/share/Domain-Hack-Finder/15778)
At the moment, it uses every TLD currently in existence, which may not be what you want since some top level domains cannot be used by most people as they require you to live in a certain area or work for a certain organization. You can customize it by adding or removing from the tlds.txt file.

View file

@ -42,11 +42,23 @@
</div>
<style>
.article-container > article :global(img) {
max-width: fit-content;
width: 100%;
article :global(img) {
max-width: 30rem;
max-height: 20rem;
margin: 0 auto;
display: block;
}
article :global(.markdown-float-left) {
float: left;
}
article :global(.markdown-float-right) {
float: right;
}
article :global(.markdown-float-left),
:global(.markdown-float-right) {
padding: 0.2em;
border-radius: 0.2rem;
margin: 0.1rem 1rem;
}
</style>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.