Reenable markdown autoformat Now that tool supports formatting markdown tables. Bug: chromium:510238003 Change-Id: Id1f19694a6049aa9423e7fd22a7e87c6a2495b97 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/478380 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#47889}
diff --git a/.style.mdformat b/.style.mdformat new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.style.mdformat
diff --git a/g3doc/style-guide.md b/g3doc/style-guide.md index 1e639ab..3f72072 100644 --- a/g3doc/style-guide.md +++ b/g3doc/style-guide.md
@@ -93,10 +93,10 @@ definition in the `.cc` file! NOTE 2: In Chromium and WebRTC [ABSL_DEPRECATE_AND_INLINE] macro is patched not -to add [[deprecated]] attribute. That allows to use the macro before all usage +to add \[[deprecated]\] attribute. That allows to use the macro before all usage in Chromium and WebRTC are cleaned up to a non-deprecated variant. -NOTE 3: In order to use the [[deprecated]] function without getting errors, +NOTE 3: In order to use the \[[deprecated]\] function without getting errors, for example in a unit test, do something like this: ```cpp @@ -130,11 +130,11 @@ For example, -| instead of | use | -|-------------------------------------|----------------------| -| `const std::vector<T>&` | `std::span<const T>` | +| instead of | use | +| ----------------------------------- | -------------------- | +| `const std::vector<T>&` | `std::span<const T>` | | `const T* ptr, size_t num_elements` | `std::span<const T>` | -| `T* ptr, size_t num_elements` | `std::span<T>` | +| `T* ptr, size_t num_elements` | `std::span<T>` | See the [cpp reference][span] for more detailed docs. @@ -152,8 +152,8 @@ WebRTC uses std::string, with content assumed to be UTF-8. Note that this has to be verified whenever accepting external input. -For concatenation of strings, use `webrtc::StrJoin` or -`webrtc::StringBuilder` directly. +For concatenation of strings, use `webrtc::StrJoin` or `webrtc::StringBuilder` +directly. For string views, use `absl::string_view`, not `std::string_view`. The former is heavily used in webrtc, and there are platforms we export to where the two are @@ -197,9 +197,9 @@ occasion. Prefer to use interfaces when that makes sense. - Prefer `webrtc::FunctionView` for cases where the callee will not save the -function object. + function object. - Prefer `absl::AnyInvocable` when you can accomplish the task by moving the -callable instead of copying it. + callable instead of copying it. ### Forward declarations @@ -261,20 +261,20 @@ The general rule is for library targets is: 1. Use `rtc_library`. -1. If the library is a header only target use `rtc_source_set`. -1. If you really need to generate a static library, use `rtc_static_library` +2. If the library is a header only target use `rtc_source_set`. +3. If you really need to generate a static library, use `rtc_static_library` (same for shared libraries, in such case use `rtc_shared_library`). To ensure that all our [GN targets][gn-target] are built with the same configuration, only use the following [GN templates][gn-templ]. -| instead of | use | -|------------------|-----------------------------------------------------------------------------------------| -| `executable` | `rtc_executable` | -| `shared_library` | `rtc_shared_library` | -| `source_set` | `rtc_library` (for header only libraries you may use `rtc_source_set`) | +| instead of | use | +| ---------------- | ------------------------------------------------------------------------------------ | +| `executable` | `rtc_executable` | +| `shared_library` | `rtc_shared_library` | +| `source_set` | `rtc_library` (for header only libraries you may use `rtc_source_set`) | | `static_library` | `rtc_static_library` (use `rtc_library` unless you really need `rtc_static_library`) | -| `test` | `rtc_test` | +| `test` | `rtc_test` | ### Target visibility and the native API @@ -322,6 +322,10 @@ warnings if preprocessor symbols are misspelled, or used without corresponding build rules to set them. +### Markdown formatting + +Markdown formatting is enabled by adding .style.mdformat to the root, which +means that all changes to .md files will be reformatted by "git cl format". [abseil]: https://abseil.io/about/ [absl_deprecate_and_inline]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/abseil-cpp/absl/base/macros.h?q=ABSL_DEPRECATE_AND_INLINE