Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add improved docs on what this project is #1147

Merged
merged 7 commits into from
May 9, 2023
Merged

Conversation

BeLi4L
Copy link
Contributor

@BeLi4L BeLi4L commented Apr 21, 2023

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

Go from this:

image

to this:

image

Signed-off-by: Valentin Vetter <BeLi4L@users.noreply.github.com>
@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Apr 21, 2023
@codecov-commenter
Copy link

codecov-commenter commented Apr 21, 2023

Codecov Report

Merging #1147 (8d2933e) into main (1e488d0) will not change coverage.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main     #1147   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          906       906           
=========================================
  Hits           906       906           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e488d0...8d2933e. Read the comment docs.

Copy link
Member

@remcohaszing remcohaszing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@wooorm
Copy link
Member

wooorm commented Apr 22, 2023

Hmm, this is intentional. Treating them as sentences in an existing paragraph, I think is arguably more correct, but also makes things smaller.

Why do you think the current actual behavior is wrong? And yours is better?

@BeLi4L
Copy link
Contributor Author

BeLi4L commented Apr 22, 2023

When I first landed on this page, I didn't see the inline In:, so I was confused that the output block had a title, but the input block didn't have any, until I realized it was inline.

It feels more logical to me to have In/Out titles like this, it gives a proper structure to the example, it's more consistent and thus make more sense to me.

If you think that it breaks the flow of the sentence, a solution could be to simply add a colon at the end, like:

You can use plugins to turn markdown into HTML:

**In**:

...

**Out**:

...

What do you think?

@wooorm
Copy link
Member

wooorm commented Apr 25, 2023

Maybe it’s better to just use actual words, sentences, and not make them “labels”:

  • **In**: -> This markdown:
  • **Plugin**: -> …with this plugin:
  • **Out**: -> …yields the following HTML:

Signed-off-by: Valentin Vetter <BeLi4L@users.noreply.github.com>
@BeLi4L
Copy link
Contributor Author

BeLi4L commented May 3, 2023

I integrated your suggestions, tell me what you think ;)

I'm not a huge fan of the intro sentence:

What is this?

You can use plugins to turn markdown into HTML.

Since directly after that, we show an example and then say:

You can use plugins to change markdown.

Shouldn't it be something like:

This library turns markdown into HTML.

instead? Without any mentions to "plugins" since it's not in the following example 🤔

@wooorm
Copy link
Member

wooorm commented May 3, 2023

Hmm, agreed that it isn’t great yet.

This library turns markdown into HTML.

Without any mentions to "plugins" since it's not in the following example

The plugin is needed (remark-html), otherwise there is no HTML.


This section is to very quickly show what this project can do, what plugins can do.
This is already explained in words earlier.
And concrete examples are given later.
Plugins can do millions of things.
The goal here is: two very short examples of input/output to illustrate that.

Perhaps that’s just impossible to do. How about we make the examples shorter, but add optional detailed info?

What about:

## What is this?

With this project and a plugin, you can turn this markdown:

```markdown
# Hello, *Mercury*!
```

…into the following HTML:

```html
<h1>Hello, <em>Mercury</em>!</h1>
```

<details><summary>Show example code</summary>

```js
import {unified} from 'unified'
import remarkParse from 'remark-parse'
import remarkHtml from 'remark-html'

const file = await unified()
    .use(remarkParse)
    .use(remarkHtml)
    .process('# Hello, *Mercury*!')

console.log(String(file)) // => '<h1>Hello, <em>Mercury</em>!</h1>'
```

</details>

With another plugin, you can turn this markdown:

```markdown
# Hi, Saturn!
```

…into the following markdown:

```markdown
## Hi, Saturn!
```

<details><summary>Show example code</summary>

```js
import {unified} from 'unified'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import {visit} from 'unist-util-visit'

const file = await unified()
    .use(remarkParse)
    .use(myRemarkPluginToIncreaseHeadings)
    .use(remarkStringify)
    .process('# Hi, Saturn!')

console.log(String(file)) // => '## Hi, Saturn!'

/** @type {import('unified').Plugin<[], import('mdast').Root>} */
function myRemarkPluginToIncreaseHeadings() {
  return (tree) => {
    visit(tree, (node) => {
      if (node.type === 'heading') {
        node.depth++
      }
    })
  }
}
```

</details>

This renders like:


What is this?

With this project and a plugin, you can turn this markdown:

# Hello, *Mercury*!

…into the following HTML:

<h1>Hello, <em>Mercury</em>!</h1>
Show example code
import {unified} from 'unified'
import remarkParse from 'remark-parse'
import remarkHtml from 'remark-html'

const file = await unified()
    .use(remarkParse)
    .use(remarkHtml)
    .process('# Hello, *Mercury*!')

console.log(String(file)) // => '<h1>Hello, <em>Mercury</em>!</h1>'

With another plugin, you can turn this markdown:

# Hi, Saturn!

…into the following markdown:

## Hi, Saturn!
Show example code
import {unified} from 'unified'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import {visit} from 'unist-util-visit'

const file = await unified()
    .use(remarkParse)
    .use(myRemarkPluginToIncreaseHeadings)
    .use(remarkStringify)
    .process('# Hi, Saturn!')

console.log(String(file)) // => '## Hi, Saturn!'

/** @type {import('unified').Plugin<[], import('mdast').Root>} */
function myRemarkPluginToIncreaseHeadings() {
  return (tree) => {
    visit(tree, (node) => {
      if (node.type === 'heading') {
        node.depth++
      }
    })
  }
}

@BeLi4L
Copy link
Contributor Author

BeLi4L commented May 3, 2023

Wow much better, I'll do that! 👍

Signed-off-by: Valentin Vetter <BeLi4L@users.noreply.github.com>
@BeLi4L
Copy link
Contributor Author

BeLi4L commented May 3, 2023

Done ;)

@wooorm
Copy link
Member

wooorm commented May 3, 2023

Oh, one small thing! The tests are failing, because by default they don’t want HTML in markdown.
You can solve this by changing package.json:

  "remarkConfig": {
    "plugins": [
-     "preset-wooorm"
+     "remark-preset-wooorm",
+     [
+       "remark-lint-no-html",
+       false
+     ]
    ]
  },

Signed-off-by: Valentin Vetter <BeLi4L@users.noreply.github.com>
@BeLi4L
Copy link
Contributor Author

BeLi4L commented May 5, 2023

Done, thank you :D

BeLi4L added 3 commits May 5, 2023 10:27
Signed-off-by: Valentin Vetter <BeLi4L@users.noreply.github.com>
Signed-off-by: Valentin Vetter <BeLi4L@users.noreply.github.com>
Signed-off-by: Valentin Vetter <BeLi4L@users.noreply.github.com>
@BeLi4L
Copy link
Contributor Author

BeLi4L commented May 5, 2023

@wooorm I tried your suggested changes, and also with "preset-wooorm" instead of "remark-preset-wooorm", but I have another error now 😅

@wooorm
Copy link
Member

wooorm commented May 9, 2023

That error was unrelated, a broken release by a build tool, which was fixed!

@wooorm wooorm changed the title Wrap example titles Add improved docs on what this project is May 9, 2023
@wooorm wooorm merged commit bb4c814 into remarkjs:main May 9, 2023
@github-actions

This comment has been minimized.

@wooorm wooorm added 📚 area/docs This affects documentation 💪 phase/solved Post is done labels May 9, 2023
@wooorm
Copy link
Member

wooorm commented May 9, 2023

Thank you!

@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label May 9, 2023
tylersmalley referenced this pull request in tailscale-dev/tailscale-dev Jun 5, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [remark](https://remark.js.org)
([source](https://togithub.com/remarkjs/remark)) | [`^14.0.2` ->
`^14.0.3`](https://renovatebot.com/diffs/npm/remark/14.0.2/14.0.3) |
[![age](https://badges.renovateapi.com/packages/npm/remark/14.0.3/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/remark/14.0.3/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/remark/14.0.3/compatibility-slim/14.0.2)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/remark/14.0.3/confidence-slim/14.0.2)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>remarkjs/remark</summary>

###
[`v14.0.3`](https://togithub.com/remarkjs/remark/releases/tag/14.0.3)

[Compare
Source](https://togithub.com/remarkjs/remark/compare/14.0.2...14.0.3)

##### Misc

-   Rerelease types for changes in TypeScript

[https://github.com/remarkjs/remark/issues/1162](https://togithub.com/remarkjs/remark/issues/1162)1162
- [`f6bd64e`](https://togithub.com/remarkjs/remark/commit/f6bd64e6)
Refactor `tsconfig`s for perf and strictness
- [`bb4c814`](https://togithub.com/remarkjs/remark/commit/bb4c8143) Add
improved docs on what this project is
by [@&#8203;BeLi4L](https://togithub.com/BeLi4L) in
[https://github.com/remarkjs/remark/pull/1147](https://togithub.com/remarkjs/remark/pull/1147)
- [`bec44aa`](https://togithub.com/remarkjs/remark/commit/bec44aa0)
Update `tsconfig.json` to use node16 module resolution
by [@&#8203;ChristianMurphy](https://togithub.com/ChristianMurphy) in
[https://github.com/remarkjs/remark/pull/1106](https://togithub.com/remarkjs/remark/pull/1106)
- [`f07f413`](https://togithub.com/remarkjs/remark/commit/f07f413f) Add
`ignore-scripts` to `.npmrc`
by [@&#8203;ChristianMurphy](https://togithub.com/ChristianMurphy) in
[https://github.com/remarkjs/remark/pull/1103](https://togithub.com/remarkjs/remark/pull/1103)
- [`134ece2`](https://togithub.com/remarkjs/remark/commit/134ece2b)
Update Actions
by [@&#8203;ChristianMurphy](https://togithub.com/ChristianMurphy) in
[https://github.com/remarkjs/remark/pull/1070](https://togithub.com/remarkjs/remark/pull/1070)
- [`974f893`](https://togithub.com/remarkjs/remark/commit/974f8936) Fix
internal types for TS 4.9

##### Plugins

- [`1e488d0`](https://togithub.com/remarkjs/remark/commit/1e488d0b) Add
`remark-ins` to list of plugins
by [@&#8203;talatkuyuk](https://togithub.com/talatkuyuk) in
[https://github.com/remarkjs/remark/pull/1129](https://togithub.com/remarkjs/remark/pull/1129)
- [`e456dc5`](https://togithub.com/remarkjs/remark/commit/e456dc5b) Add
`remark-flexible-markers` to list of plugins
by [@&#8203;talatkuyuk](https://togithub.com/talatkuyuk) in
[https://github.com/remarkjs/remark/pull/1126](https://togithub.com/remarkjs/remark/pull/1126)
- [`42114fc`](https://togithub.com/remarkjs/remark/commit/42114fc6) Add
`remark-flexible-paragraphs` to list of plugins
by [@&#8203;talatkuyuk](https://togithub.com/talatkuyuk) in
[https://github.com/remarkjs/remark/pull/1120](https://togithub.com/remarkjs/remark/pull/1120)
- [`6aa638a`](https://togithub.com/remarkjs/remark/commit/6aa638ab) Add
`remark-flexible-containers` to list of plugins
by [@&#8203;talatkuyuk](https://togithub.com/talatkuyuk) in
[https://github.com/remarkjs/remark/pull/1112](https://togithub.com/remarkjs/remark/pull/1112)
- [`20e7543`](https://togithub.com/remarkjs/remark/commit/20e75435) Add
`remark-flexible-code-titles` to list of plugins
by [@&#8203;talatkuyuk](https://togithub.com/talatkuyuk) in
[https://github.com/remarkjs/remark/pull/1108](https://togithub.com/remarkjs/remark/pull/1108)
- [`32d6948`](https://togithub.com/remarkjs/remark/commit/32d69488) Add
`remark-cloudinary-docusaurus` to list of plugins
by [@&#8203;johnnyreilly](https://togithub.com/johnnyreilly) in
[https://github.com/remarkjs/remark/pull/1090](https://togithub.com/remarkjs/remark/pull/1090)
- [`28aa8b9`](https://togithub.com/remarkjs/remark/commit/28aa8b9a)
update tests for changes in `mdast-util-to-markdown`
- [`9af1a87`](https://togithub.com/remarkjs/remark/commit/9af1a876) Add
`remark-code-title` to list of plugins
by [@&#8203;kevinzunigacuellar](https://togithub.com/kevinzunigacuellar)
in
[https://github.com/remarkjs/remark/pull/1076](https://togithub.com/remarkjs/remark/pull/1076)
- [`0d1eb09`](https://togithub.com/remarkjs/remark/commit/0d1eb09a) Add
7 plugins to list of plugins
by [@&#8203;Xunnamius](https://togithub.com/Xunnamius) in
[https://github.com/remarkjs/remark/pull/1064](https://togithub.com/remarkjs/remark/pull/1064)
- [`c7e8171`](https://togithub.com/remarkjs/remark/commit/c7e81713)
Remove deprecated `remark-jargon`
by [@&#8203;LunaticMuch](https://togithub.com/LunaticMuch) in
[https://github.com/remarkjs/remark/pull/1059](https://togithub.com/remarkjs/remark/pull/1059)

**Full Changelog**:
remarkjs/remark@14.0.2...14.0.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/tailscale-dev/tailscale-dev).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS44Ny4xIiwidXBkYXRlZEluVmVyIjoiMzUuODcuMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 area/docs This affects documentation 💪 phase/solved Post is done
Development

Successfully merging this pull request may close these issues.

4 participants