Skip to content

Turn on -preview=markdown#2665

Merged
dlang-bot merged 1 commit intodlang:masterfrom
dgileadi:enable-markdown
Jun 26, 2019
Merged

Turn on -preview=markdown#2665
dlang-bot merged 1 commit intodlang:masterfrom
dgileadi:enable-markdown

Conversation

@dgileadi
Copy link
Contributor

This PR does three things:

  1. Adds the -preview=markdown flag to the dlang.org Ddoc build.
  2. Customizes the Ddoc-generated OTHER_CODE macro to support future instances of ``` some-language code fences.
  3. Fixes places in the docs that were unintentionally interpreted as markdown.

The fixes in item 3 were generally for:

  1. Places that match Markdown's asterisk rules for emphasis. These places are generally in code examples, but since they aren't wrapped in fenced code blocks Ddoc isn't aware that it's supposed to treat them as code.
  2. Backslashes that aren't in code blocks, and so are treated as escaping the next character.
  3. Lines that start with - or +, which in Markdown starts a list item.
  4. Lines that start with >, which in Markdown starts a quote block.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @dgileadi! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

articles/ctod.dd Outdated
To specifiy the file c:\root\file.c you would use:
$(CCODE
char file[] = "c:\\root\\file.c";
`char file[] = "c:\\root\\file.c";`
Copy link
Contributor

Choose a reason for hiding this comment

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

This will make the font bold. That will result in some code blocks look different from others. Not sure if that matters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once you pointed it out it bothered me enough that I went ahead and used ```c fences for these three items.

Copy link
Member

@PetarKirov PetarKirov left a comment

Choose a reason for hiding this comment

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

Thanks for taking this closer to the finish line!
In addition to comments below, I also noticed that the output of some files changed like lex.dd, in which the list of escape sequences was now interpreted differently - IIRC from e.g. \n to n. In all those cases, the $(D ...) macro was used, so most likely the fix would be to use code blocks.

@@ -859,8 +859,8 @@ $(H4 The C Way)
C initializes arrays by positional dependence. C99 fixes the issue:
$(CCODE
Copy link
Member

Choose a reason for hiding this comment

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

Can we used a fenced C code block here?

```C
int a[3] = { 3,2,1 };
/* ... */
```

Copy link
Member

Choose a reason for hiding this comment

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

Ditto for the rest of the $(CCODE ..) changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We certainly could, although we'd use a lowercase c to work with the existing CSS. The reason I didn't switch them is because I wanted to minimize the amount of changes, and if we change one we'd probably want to change them all.

$(UL
$(LI $(LINK2 http://docs.algorithm.dlang.io/latest/mir_ndslice_topology.html, `mir.ndslice.topology`)
- Multidimensional `std.range` analog. Includes `bitwise`, `bitpack`, `zip`, `unzip`, `map`, `indexed` and many other features.)
\- Multidimensional `std.range` analog. Includes `bitwise`, `bitpack`, `zip`, `unzip`, `map`, `indexed` and many other features.)
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps the dash should be moved to the end of the previous line to avoid escaping it?

$(P
$(CONSOLE
sed "s/delete \(.*\);/__delete(\1);/" -i **/*.d
`sed "s/delete \(.*\);/__delete(\1);/" -i **/*.d`
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should replace all uses of $(CONSOLE ...) with something along the lines of:

```console
```

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again, the reason I didn't make a change like this (and I was tempted to) is to minimize the amount of changes.

var redir = window.location.href.replace(
/\/changelog\/index.html#(?:2\.|new2_)(\d+(?:\.\d+)?)$(DOLLAR)/,
/\\/changelog\\/index.html#(?:2\\.|new2_)(\\d+(?:\\.\\d+)?)$(DOLLAR)/,
"/changelog/2.$(DOLLAR)1.html"
Copy link
Member

@PetarKirov PetarKirov Jun 24, 2019

Choose a reason for hiding this comment

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

Wow, using inline js with regex inside ddoc files looks like a bad idea. All JS code should be defined in *.js files and included automatically inline if really necessary. That said, this out of the scope of your PR, so I'm fine with leaving it like this.

@dgileadi
Copy link
Contributor Author

In addition to comments below, I also noticed that the output of some files changed like lex.dd, in which the list of escape sequences was now interpreted differently - IIRC from e.g. \n to n. In all those cases, the $(D ...) macro was used, so most likely the fix would be to use code blocks.

That worries me because I didn't see that behavior locally. It makes me wonder what else I might have missed. If it isn't too much trouble, could you let me know which files you saw that had issues?

@CyberShadow
Copy link
Member

@ZombineDev The documentation tester isn't showing any changes in lex.html, so I'm also confused why you would be seeing a difference in your output.

There are changes in lex.verbatim, but this is a partial preview of the intermediary expanded state of macros, and changes there don't necessarily map to changes in the final HTML render.

@PetarKirov
Copy link
Member

Yes, @CyberShadow, you're absolutely right! I must have confused the verbatim vs html diffs. @dgileadi sorry for the false alarm.

Copy link
Member

@PetarKirov PetarKirov left a comment

Choose a reason for hiding this comment

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

I did another pass through your latest changes and I also checked the diff of all *.html files and I'm pleasantly surprised at how little has changed in the output. And were it changed I think it was an improvement.

Everything LGTM.

@dgileadi thanks for your outstanding work and persistence!

@PetarKirov
Copy link
Member

@CyberShadow @aG0aep6G @wilzbach you guys may also want to have a look before we merge this PR. From my PoV it's good to go.

@dlang-bot dlang-bot merged commit 7f257d7 into dlang:master Jun 26, 2019
@PetarKirov PetarKirov added 72h no objection -> merge The PR will be merged if there are no objections raised. and removed auto-merge labels Jun 26, 2019
@PetarKirov
Copy link
Member

Arghh.. I meant to leave this open for others to review. @CyberShadow if you have any high-level concerns that cannot be easily addressed with a follow-up, feel free to revert this PR, so we can have more time to review.

@CyberShadow
Copy link
Member

No concerns, thank you @dgileadi for your work.

@dgileadi dgileadi deleted the enable-markdown branch June 26, 2019 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

72h no objection -> merge The PR will be merged if there are no objections raised. Ddoc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants